Thanks to visit codestin.com
Credit goes to github.com

Skip to content

blockquotes that are... not really blockquotes #1068

@orangecms

Description

@orangecms

Hi! I'm coming a long way. please let me elaborate. 🥺

The extended block quotes in GitHub Flavored Markdown (GFM) are being sorta-abused to mark other kinds of blocks, too, such as for various info boxes (note, tip, warning...) - which is what BlockQuoteKind stems from, IIUC.
I'm not sure where this comes from, but I want to take it for granted, and improve the docs and rendering behavior.
At least I don't find it in https://github.github.com/gfm/#block-quotes, though I do know that GitHub supports this.

Currently:

Tag::BlockQuote(kind) => {
let class_str = match kind {
None => "",
Some(kind) => match kind {
BlockQuoteKind::Note => " class=\"markdown-alert-note\"",
BlockQuoteKind::Tip => " class=\"markdown-alert-tip\"",
BlockQuoteKind::Important => " class=\"markdown-alert-important\"",
BlockQuoteKind::Warning => " class=\"markdown-alert-warning\"",
BlockQuoteKind::Caution => " class=\"markdown-alert-caution\"",
},
};
if self.end_newline {
self.write(&format!("<blockquote{}>\n", class_str))
} else {
self.write(&format!("\n<blockquote{}>\n", class_str))
}

i.e., if no "kind" is provided, it renders as a <blockquote>, which usually semantically fits.

If a kind (i.e., note, tip, etc., starting with a specific marker, say, > [!Info]) is provided, then it is still rendered as a <blockquote> in pulldown-cmark, which I find semantically irritating, especially with assistive tooling.
I suggest changing the name of the not-really-quote-blocks to something carrying those semantics, such as Admonition, and for rendering, use a <div> with role="note" (see also rust-lang/mdBook#3026).

For ref, on GitHub, it turns into this, using a <div> (see browser dev tools):

Note

interesting thing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions