Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper support for GH notice boxes (highlight using blockquote) #29

Closed
michalfita opened this issue Dec 27, 2023 · 3 comments
Closed

Comments

@michalfita
Copy link

Problem

GitHub now supports notice boxes as per https://github.com/orgs/community/discussions/16925 using special formatting of blockquotes, however mdformat-gfm escapes square brackets used in them:

Original:

> ![TIP]
> In above commands **`latest`** can also be replaced via e.g. **`1.0.3`** to get a specific container version.

Changed:

> !\[TIP\]
> In above commands **`latest`** can also be replaced via e.g. **`1.0.3`** to get a specific container version.

This breaks our Markdown documents in pre-commit (michalfita/packer-plugin-cross#12)

Suggestion

Add support to not escape square brackets if prepend with exclamation mark.

@dbast
Copy link

dbast commented Dec 30, 2023

The solution here is to write [!TIP] (! inside the []), which is formatted by mdformat to \[!TIP\] and rendered correctly by GitHub.

@michalfita
Copy link
Author

OK, I'm surprised this works that way... however, I think mdformat shouldn't touch these brackets in such case - the result is much less pleasant to deal with in raw Markdown.

@hukkin
Copy link
Owner

hukkin commented Jan 2, 2024

Thanks for the issue!

This plugin formats Markdown that follows the GFM spec (rendered text here https://github.github.com/gfm/ and source text here https://github.com/github/cmark-gfm/blob/master/test/spec.txt). The GFM spec does not include some Markdown features supported by github.com (very notably frontmatter and footnotes), and the notice box syntax falls in the same category.

In the current state, a separate plugin for the notice box syntax needs to be created (or alternatively a mdformat-github or similar that aims to keep up with Github's syntax updates.

I'm closing the issue here seeing that this isn't a concern for the mdformat-gfm plugin.

@hukkin hukkin closed this as completed Jan 2, 2024
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

No branches or pull requests

3 participants