Would like to add html attributes via Markdown

One thing I’m really missing from kramdown is inline attribute lists.

This paragraph will have a class of *myClass* and an ID of *myID*.
{: .myClass #myID}

Hugo already supports Mmark, which makes this almost possible, but even with Mmark it doesn’t work on arbitrary paragraphs. I also don’t like having to change the extension on my .md files to .mmark to switch Markdown renderers.

I looked into using shortcodes, but I didn’t get very far.

Am I missing an available solution?

I’m pretty sure you can set the markdown=mmark in page frontmatter. As to the question; if the markdown rendererers doesn’t support it, your best bet is shortcodes.

Oh, that is a bit nicer than changing the file extension. Very helpful, thank you!

This would be great to have in the documentation since Mmark seems to be much more capable than Blackfriday! No additional install required even (at least running the homebrew version of Hugo)

Edit: If I would like to help out by editing the documentation, should I do this on the master branch or on the v0.16.docs branch? (or another branch all together)

Do all edits on master branch. Relevant changes will be backported to 0.16.

1 Like

I spoke too soon… Blackfriday handles inline header IDs now as well it would seem. Adding

markdown: mmark

to my YAML frontmatter did not produce any error, but did not use Mmark as Block Tables did not work…

however…

markup: mmark

does work :blush: