shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.31k stars 1.24k forks source link

Question on remark plugins #3159

Closed tomw1808 closed 2 weeks ago

tomw1808 commented 2 weeks ago

Hi there - great work with the project, I admire your perseverance and the rewrite of a large part for v3. I hope this is not the wrong place to ask, I couldn't find any other place, and I couldn't find any other issue asking a similar question.

I saw someone asked about the remark-admonitions not working which was a non-fix at that time. I stumbled upon this project, because I was looking for a replacement for mkdocs material using nextjs. And I think a lot of people will look for a drop-in replacement for e.g. docusaurus, mkdocs, etc. I think its almost there, minus a few remark plugins.

I hope I am not overstepping with this question, given how much work it potentially is, but is there any way (or planned) to allow adding custom remark plugins into the compile part of the nextra server on the fly? I didn't find anything like "here's an additional array of plugins during setup", but I have to say its hard to navigate the branches to understand what's the most current version being worked on (v2 vs v3 vs v4 (?)).

I saw someone added a remark plugin through a PR, which I think is a very static way of adding functionality and that's also only half of the story, because some tags are different in docusaurus vs mkdocs, so a drop-in replacement wouldn't be possible without configuring the plugins (e.g. admonitions in mkdocs are !!! vs ::: in docusaurus, but that's just one of the plugins, there are others too).

Again, I hope this is a sensible question. If that's been asked already, please let me know where, I couldn't find anything in the issues (closed or open).

tldr: is there a way for remark plugins to be added to the compile part?

dimaMachina commented 2 weeks ago

see example of passing remark/rehype/recma plugins https://github.com/shuding/nextra/issues/1356#issuecomment-1399566359

tomw1808 commented 2 weeks ago

Thats awesome, thanks!