syntax-tree/mdast

Add support for shortcode blocks

alexandernanberg opened this issue · 1 comments

Apologies if this is posted in the wrong place, might belong to the ideas repo instead? I can move it in that case.

I'd really love to see shortcode parsing built-in. That would open up a lot of doors especially when working with Gatsby etc. I think the way Hugo handles it is pretty nice https://gohugo.io/content-management/shortcodes/

Hey @alexandernanberg! 👋
mdast/remark generally stick to CommonMark for features included in core, and keep syntax extensions that are above and beyond CommonMark as remark plugins.

Shortcodes would be included in the above and beyond.
That being said, several flavors of shortcodes are available for remark today via plugins.

remark-shortcodes

The example below uses the default start & end blocks that
this parser ships with:

[[ MailchimpForm id="chfk2" ]]

But they are configurable, so if you're coming from Hugo say,
you can set them as such:

{{< MailchimpForm id="chfk2" >}}

remark-macro

# Hello

Writing some markdown

[alert]
This is an alert message
[/alert]

mdx

import { Chart } from '../components/chart'

# Here’s a chart

The chart is rendered inside our MDX document.

<Chart />