Skip to content

GitHub alerts html uses DOM structure deviating from GitHub. #11365

@chrisgrieser

Description

@chrisgrieser

A markdown file with these github-style alerts:

> [!Note]
> foobar

Using pandoc --from=gfm --to-html results in this HTML:

<div class="note">
<div class="title">
<p>Note</p>
</div>
<p>foobar</p>
</div>

However, on the GitHub website, that alert is rendered as:

<div class="markdown-alert markdown-alert-note">
<p class="markdown-alert-title">Note</p>
<p>foobar</p>
</div>

This is a problem, since common css files like github-markdown.css assume the latter HTML to style alerts correctly.

Also, the latter format makes more sense, and is more verbose in its use of more specific classes, so it would be preferable to use either way, imo.

Describe alternatives you've considered.
Manually rewrite the HTML generated by pandoc to match the GitHub one, OR rewrite the css file to target pandoc's HTML. But quite unconvenient.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions