knadh / listmonk

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
https://listmonk.app
GNU Affero General Public License v3.0
15.25k stars 1.39k forks source link

Specifying HTML/CSS attributes in markdown #2060

Open olib14 opened 1 month ago

olib14 commented 1 month ago

Pandoc can be used to generate HTML content from a template HTML file, CSS styling and markdown content.

With it, you can specify attributes (id, class, width, height) for things, such as:

Links and images:

![](foo.jpg){#id .class width=30 height=20px} 

See: https://garrettgman.github.io/rmarkdown/authoring_pandoc_markdown.html#images (Extension: link_attributes)

Headers:

# My header {#identifier .class}

See: https://garrettgman.github.io/rmarkdown/authoring_pandoc_markdown.html#headers (Extension: header_attributes)

In practice, this allows you to provide a class to make an image float, and set its width to a nice value. Currently this functionality is still possible with raw HTML:

<img src="foo.jpg" class="float-right" style="width: 8em"/>
![](foo.jpg){.float-right width=8em}

<h3 class="fancy-heading">What's New<h3>
### What's New {.fancy-heading}

It would be a big QoL improvement (but understandably not be high priority as raw HTML allows for this and more).

knadh commented 1 month ago

If @yuin/goldmark, which listmonk uses for parsing Markdown, has support for this, there is no problem in enabling it. From a cursory look, I am not sure if it supports though.