Skip to content

feat: add option to emit semantic HTML for alerts - #822

Merged
kivikakk merged 7 commits into
kivikakk:mainfrom
flying-sheep:pa/alert-semantic-html
Jul 12, 2026
Merged

feat: add option to emit semantic HTML for alerts#822
kivikakk merged 7 commits into
kivikakk:mainfrom
flying-sheep:pa/alert-semantic-html

Conversation

@flying-sheep

@flying-sheep flying-sheep commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

fixes #821.

Design question: Maybe it should be made more generic, e.g. rename it to HtmlStyleType and have it affect tasklist_classes too – for some reason you don’t add a markdown- prefix for that class, only for alerts. But then it would be a breaking change as its default would either change render.tasklist_classes or extension.alerts.

@codspeed-hq

codspeed-hq Bot commented Jul 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 1 untouched benchmark


Comparing flying-sheep:pa/alert-semantic-html (d2e4a46) with main (45c1995)

Open in CodSpeed

@kivikakk

Copy link
Copy Markdown
Owner

Design question: Maybe it should be made more generic, e.g. rename it to HtmlStyleType and have it affect tasklist_classes too – for some reason you don’t add a markdown- prefix for that class, only for alerts. But then it would be a breaking change as its default would either change render.tasklist_classes or extension.alerts.

Maybe! The naming of the tasklist classes there was pretty arbitrary and decided upon by whoever implemented them at the time; I kind of think Comrak itself should probably not have much in the way of opinions about classes at all, and anyone who really wants them probably wants to implement a custom formatter.

But for now, we have what we have. (I'm pretty OK with breaking changes FWIW! What's the point of pre-1.0 if we can't have fun?)

Thanks so much for this PR! I really appreciate it. I'll add a CLI entrypoint and merge :)

@kivikakk
kivikakk merged commit 087b0ce into kivikakk:main Jul 12, 2026
27 checks passed
@kivikakk

Copy link
Copy Markdown
Owner

This is part of Comrak v0.54.0!

@flying-sheep
flying-sheep deleted the pa/alert-semantic-html branch July 12, 2026 15:05
@flying-sheep

Copy link
Copy Markdown
Contributor Author

Thanks! This will help tools that support different markup languages!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match docutils/rST HTML output for admonitions/alerts

2 participants