jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.97k stars 3.35k forks source link

Support for Github "Alerts" #10109

Open Sajjon opened 3 weeks ago

Sajjon commented 3 weeks ago

Describe your proposed improvement and the problem it solves. Seems this (great) tool does not render Github Markdown "alerts", as Github does.

Pandocs rendering

pandoc

Githubs rendering

github

For this markdown:

> [!CAUTION]
> You **MUST** use the Rust programming language.

Using command:

pandoc --from=gfm --to=pdf -o PANDOC.pdf README.md

Would be nice to get the same kind of appearance as Github Markdown uses.

Describe alternatives you've considered. N/A

Sajjon commented 3 weeks ago

This is perhaps a duplicate of https://github.com/jgm/pandoc/issues/9716

jgm commented 3 weeks ago

No, it's not a duplicate of #9716, which concerns pandoc's markdown and not gfm. GitHub alerts are supported in gfm.

pandoc -f gfm -t native
> [!CAUTION]
> You **MUST** use the Rust programming language.
^D
[ Div
    ( "" , [ "caution" ] , [] )
    [ Div ( "" , [ "title" ] , [] ) [ Para [ Str "Caution" ] ]
    , Para
        [ Str "You"
        , Space
        , Strong [ Str "MUST" ]
        , Space
        , Str "use"
        , Space
        , Str "the"
        , Space
        , Str "Rust"
        , Space
        , Str "programming"
        , Space
        , Str "language."
        ]
    ]
]

The issue is that the writers don't by default do any special styling for this structure. See #9821 for a filter that may help with PDF output.

jgm commented 3 weeks ago

For background see also https://github.com/jgm/commonmark-hs/issues/132#issuecomment-1856751436