djm / remark-shortcodes

A custom Markdown syntax parser for remark that adds support for shortcodes.
MIT License
45 stars 7 forks source link

Migrate to remark@v13 and it's new parser (micromark) #19

Open wooorm opened 4 years ago

wooorm commented 4 years ago

Hi!

remark is switching to a new parser (and compiler) internally (micromark, remarkjs/remark#536), which will break this plugin. This plugin seems a bit similar in style to footnotes. There is a micromark extension and mdast extension for that already, and soon those two will be in the remark wrapper plugin remark-footnotes. Keep an eye out for that update, which might serve well as inspiration, and feel free to ask me questions!

djm commented 3 years ago

If anyone would like to take the work on to move this package onto the new remark (v13+) & micromark system then please reply here. I don't use this package myself anymore, so I won't be tackling the work but am more than happy to keep reviewing + maintaining it for the time being.

Just shout :)

wooorm commented 3 years ago

/cc @ChristianMurphy I remember you were using this plugin somewhere? Or was it something else?

Also: for other folks seeing this: directives are somewhat semi-standard (implemented in many markdown parsers) and can do similar things to shortcodes, so if a different syntax is fine, maybe it’s of interest: https://github.com/remarkjs/remark-directive

ChristianMurphy commented 3 years ago

I do have a project that uses this, though the project is now in maintenance, rather than active development. I'm in a similar spot as @djm, I don't have rewriting the parser on my roadmap at the moment, but am happy to review a PR if a community member opens one.

djm commented 3 years ago

so if a different syntax is fine, maybe it’s of interest: remarkjs/remark-directive

Nice, thanks @wooorm.

If this works for folks, I would 100% suggest going down this route given it's a core-maintained package.

I'll update the README to point to that.

djm commented 3 years ago
CleanShot 2021-02-01 at 12 05 09@2x

Done! Thanks again.

wooorm commented 3 years ago

Awesome! Yeah, I’d suggest folks to use directives. Different extensions are possible, but it extensions always make your content less portable. Directives are perhaps slightly better because it’s “somewhat semi-standard”

Thanks for adding it to the readme Darian!

lucascaton commented 3 years ago

Does anyone have a usage example of https://github.com/remarkjs/remark-directive? The example from their README isn't very easy to understand/follow. 😕 Thanks!

I've found a nice working example here: https://github.com/remarkjs/react-markdown/issues/585#issue-871290173