Provide template for rendered markdown? - Rib

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Rizary

Right now I have block of article pages that only have Pandoc.render val and the markdown get rendered into my article page. However, since I use tailwind-css and it does reset all style value, then there is no difference between h1 and p. And it will be styled by specifying each tag's class.

Is there any additional step that I need to do if I want to use that css, so let say I can provide template so that the rendered result will already contain the class that I have in my template. For example, rather than got <h1> Hello World</h1>, the result will be like <h1 class="text-xl" > Hello World </h1>?

Or do I need to custom it in lucid part?

Sridhar Ratnakumar

Render your doc inside a div with some class, and then style descendant elements in that class?

Rizary

I did think of that. Is there any other option?

Sridhar Ratnakumar

Not sure if Pandoc will ever support this: https://github.com/jgm/pandoc/issues/684

I'd like to suggest that Pandoc allow attributes to be attached to any Markdown element, not just code blocks. So for example, if it encountered this: #{.main} Header it would generate this: &l...
Sridhar Ratnakumar

But commonmark-hs does: https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/attributes.md

Pure Haskell commonmark parsing library, designed to be flexible and extensible - jgm/commonmark-hs
Sridhar Ratnakumar

I'd recommend the div approach, if you want to style all documents uniformly.

Sridhar Ratnakumar

Or you can write a Pandoc extension? Or a MMark extension: https://github.com/srid/neuron/blob/master/src/app/Text/MMark/Extension/SetTableClass.hs

Haskell meets Zettelkasten, for your plain-text delight. - srid/neuron
Rizary

Noted! I'll take a look into that. Yeah I think pandoc will not support it.