mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Add non-English search support

Open Sunshine40 opened this issue 9 months ago • 0 comments

This PR implements the search-non-english feature, inspired by #1496.

Configure book.language like this:

[book]
author = ["The Rust Project Developers", "Pure White."]
title = "Rust 秘典(死灵书)"
description = "Unsafe Rust 的黑魔法指南"
language = "zh-Hans"

and with search-non-english feature enabled, mdBook would choose the search indexing implementation based on the language config.

You can use this repo to try it out, or preview the search functionality online!

language config should follow lang - HTML: HyperText Markup Language | MDN > Language tag syntax.

Currently supported languages can be found in the languages section of elasticlunr-rs's feature flag list

~Note: teaser is still buggy (at least for Chinese).~

Sunshine40 avatar May 20 '24 15:05 Sunshine40