cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
438 stars 67 forks source link

fix: properly handle HTML comments #65

Closed Josh-Cena closed 2 years ago

Josh-Cena commented 2 years ago

Fix #64.

In Docusaurus beta.7, comments are no longer removed from the build output. (https://github.com/facebook/docusaurus/pull/5629) This has caused the issue https://github.com/facebook/docusaurus/issues/5716. This PR makes the plugin handle comment nodes properly.

Josh-Cena commented 2 years ago

@cmfcmf Is it possible that we use a fail-safe strategy and just return "" for all nodes whose type we don't know?

cmfcmf commented 2 years ago

Thank you @Josh-Cena for submitting this PR! It looks good :)

@cmfcmf Is it possible that we use a fail-safe strategy and just return "" for all nodes whose type we don't know?

Fair point. I made it a hard error so that people would notice if some element type was missing instead of silently getting possibly wrong results. But I also see the point of not unnecessarily breaking everyone's builds. I have changed it like you suggested, but to also output a warning message that requests users to open an issue. That should be a good middle ground.