ultrabug / mkdocs-static-i18n

MkDocs i18n plugin using static translation markdown files
https://ultrabug.github.io/mkdocs-static-i18n/
MIT License
232 stars 39 forks source link

FIX: Changes to be compatible with new mkdocs-materials. #148

Closed hhslepicka closed 1 year ago

hhslepicka commented 2 years ago

The latest changes (~8 days ago) of mkdocs-material-insiders caused this plugin to break. This PR is an attempt to fix the issue. Sorry if I missed something specific about how to handle it properly.

Some reference of the changes:

ultrabug commented 2 years ago

@squidfunk it looks like you're diverging from mkdocs' plugin internals, am-I right?

squidfunk commented 2 years ago

Yes, I recently removed the dependency of Material for MkDocs' search from MkDocs' own search in https://github.com/squidfunk/mkdocs-material-insiders/commit/b539b5dbaf7bc1442aed6674f2944901221307a8. It's an entire rewrite of the search plugin that is shipped with Material for MkDocs which is not compatible with MkDocs own implementation and will likely continue to diverge as we add more functionality to the search.

Please note that when the next funding goal is reached, Material for MkDocs' community edition will include the new search plugin. From that version on, Material for MkDocs will not be compatible with MkDocs' own search anymore. This is likely to happen within the next 3-6 weeks. You can read about the new search in our blog article.

This PR will break compatibility with other themes, since it relies on internal details of the search plugin, which I wouldn't recommend doing. The search_index.json is and likely will remain API-compatible, so it's best to load this file after the search plugin generated it and transform it than accessing property of the search plugin.

ultrabug commented 2 years ago

Thanks @squidfunk

It's an entire rewrite of the search plugin that is shipped with Material for MkDocs which is not compatible with MkDocs own implementation and will likely continue to diverge as we add more functionality to the search.

May I ask if you considered contributing it in MkDocs itself? Are there too many material specifics?

squidfunk commented 2 years ago

May I ask if you considered contributing it in MkDocs itself? Are there too many material specifics?

I already discussed this with @oprypin – it's not possible, because themes need to be adjusted, since the search index now contains HTML, not plain text. Upstreaming this will break all themes. Additionally, I need to keep a separate implementation which allows me to add new features to Material for MkDocs without worrying about breaking other themes.

oprypin commented 2 years ago

@squidfunk Well, we did discuss, but my opinion remained that upstreaming is the best option, it's just that it is really inconvenient for you so I can't convince you to do it. I was saying that themes can be asked to opt in to the new behavior and otherwise old behavior kept.

squidfunk commented 2 years ago

If somebody wants to maintain it, the source will be freely available. I just can't.