streamlit / docs

Source code for the Streamlit Python library documentation
https://docs.streamlit.io
Apache License 2.0
119 stars 474 forks source link

Fix search indexing for html commands and changelog #1055

Closed sfc-gh-dmatthews closed 6 months ago

sfc-gh-dmatthews commented 6 months ago

📚 Context

Streamlit commands ending in .html were not indexed correctly (#1052). Additionally, the changelog was not getting indexed because it was too long. This PR fixes that.

🧠 Description of Changes

🌐 References

Notion project: Algolia search problems

Closed #1052

Contribution License Agreement By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

sfc-gh-dmatthews commented 6 months ago

@sfc-gh-tteixeira I went into the search index and manually added a color for the "Quick reference" page. It won't change how the production site displays anything since it's unused, but it let's you see a hypothetical category color incorporated in this preview:

image

From pattern-matching (since I'm not sure the best way to test-run the script), I'm guessing we can pull the colors in the same way we pull the icons. In this way, search results can be color-coded to match their categories. There are two different CSS files for the search modal, so the highlight color is suboptimal as it is less direct (using an <em> child of a classed container rather than the direct highlight class applied to <em>). I wasn't quite sure if there was a good way to mix classes between to the files... What I really want is something like .IndigoHighlight ais-Snippet-highlighted, but I don't know if there's a trick to do that.