Markdown inside eleventy shortcodes

published: 30 November 2026

I use Jekyll for this site but use Eleventy for my politics blog Last Week. I wanted to add an aside section in a post however the markdown parser that Eleventy uses, markdown-it, doesn’t support markdown=1 in tags to enable markdown parsing inside HTML blocks.

Instead I would have to use shortcodes. I found instructions for parsing markdown inside shortcodes by Aleksandr Hovhannisyan which I’m sure work however it seemed rather complicated so I continued to look for an easier solution.

I stumbled upon a comment on a more basic tutorial in CSS IRL that says that you can leave a blank line around the markdown to (presumably) trick the parser into not realising that it is in a HTML block.

I used this to create a working aside shortcode - note the blank lines between the tags.


// eleventy.config.js

eleventyConfig.addPairedShortcode('aside', (children) => `<aside>
${children}

</aside>`);

`

Written by Tom Brandis

Reply with email

Follow with RSS