backstage / mkdocs-techdocs-core

The core MkDocs plugin used by Backstage's TechDocs as a wrapper around multiple MkDocs plugins and Python Markdown extensions
Apache License 2.0
83 stars 61 forks source link

Optionally use material search #202

Open alexef opened 5 days ago

alexef commented 5 days ago

fixes: #192

see also: https://github.com/backstage/backstage/pull/25497

the search/search_index.json template behaves differently based on which search plugin is being used.

with this change, we allow users to use material theme's search for generating the index.

Differences:

Mkdocs search Material theme search
Document split Both entire document and heading sections Only headings
Content escaping Yes, both title and text No, only titles. Text still contains html tags
Tags support No Yes
Boost support No Yes
alexef commented 4 days ago

(validated this works as expected in https://github.com/alexef/mkdocs-techdocs-core/blob/dev/src/core.py#L22, but I'm yet to validate that using custom settings like the proposed way in this PR will work)

alexef commented 4 days ago

We are using it locally and search seems to work just like before (except that now we don't get duplicate results).

Updated README added a tiny unit test. If you can please have another look.