mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Non-English search support

Open Sunshine40 opened this issue 9 months ago • 5 comments

#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
    • [x] Fix buggy teaser (preview) ^1
      • [x] Keyword highlighting doesn't work as expected for Chinese
      • [x] 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
      • [x] 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?

Sunshine40 avatar May 20 '24 15:05 Sunshine40