Skip to content

Two issues with Marko's handling of GitHub Alerts/Callouts #251

@facelessuser

Description

@facelessuser

When parsing alerts, GitHub has two behaviors that Marko does not follow.

Case Sensitivity of Alert Types

GitHub handling of the alert type is not case sensitive. Marko only works if the type is capitalized.

> [!note]
> Content

Note

Content

>>> from marko.ext.gfm import gfm
>>> gfm('> [!note]\n> Content')
'<blockquote>\n<p>[!note]\nContent</p>\n</blockquote>\n'

Content Handling After Alert Type

GitHub does not allow custom titles after the alert type like Obsidian does. If GitHub encounters anything after the alert type, on the same line, it will treat the block as a normal blockquote. Marko throws away this content and renders an alert. Text should not get thrown away.

> [!NOTE] Not allowed
> Content

[!NOTE] Not allowed
Content

>>> from marko.ext.gfm import gfm
>>> gfm('> [!NOTE] Not allowed\n> Content')
'<blockquote class="alert alert-note">\n<p>Note</p>\n<p>Content</p>\n</blockquote>\n'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions