rust-lang / rust-lang/mdBook

Non-English search support

Open
#2,393 6 comments 23 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
22.2k
Forks
1.9k
PR merge metrics
PR metrics pending

Description

#1081 has been stuck for a while, so I tried implementing my own version.

Preview the search functionality online

Inspired by #1496.

Major implementation steps:
  • Land #2392
    • Fix buggy teaser (preview) ^1
      • Keyword highlighting doesn't work as expected for Chinese
      • The selected range displayed as teaser sometimes contains no keywords at all (the target chapter does contain the keyword though)
    • Enhance mixed multi language search support
      • Implement a "fallback" strategy for text in mixed languages (detail)
  • Support Emoji search
  • Localize UI rendered by HTML renderer
Unresolved questions:
  • Should search-non-english feature be enabled by default? (Not likely, since it causes severe binary size bloat)
    • Should each supported language have an individual feature flag? Would it make the feature flag list too noisy?
  • Should we consider other search solutions than elasticlunr.js & lunr-languages?
  • Should the new "fallback" search implementation apply to English books as well?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing #2392 and the linked implementation details, then examine the elasticlunr-rs indexing work and the HTML renderer localization scope. Done means the remaining checklist items are resolved and the feature-flag, search-solution, and fallback-strategy questions have decisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
search, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.