豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Inconsistent behaviour of the Markdown reader when processing GitHub-style alerts #11534

@cagix

Description

@cagix

The Markdown reader would parse GitHub alerts differently depending if the option lists_without_preceding_blankline is present or not:

% pandoc -f markdown+alerts -t native 
:::: caution
::: title
Caution
:::

Foo bar, wuppie fluppie!
::::

^D
[ Div
    ( "" , [ "caution" ] , [] )
    [ Div ( "" , [ "title" ] , [] ) [ Para [ Str "Caution" ] ]
    , Para
        [ Str "Foo"
        , Space
        , Str "bar,"
        , Space
        , Str "wuppie"
        , Space
        , Str "fluppie!"
        ]
    ]
]

vs.

% pandoc -f markdown+alerts+lists_without_preceding_blankline -t native 
:::: caution
::: title
Caution
:::

Foo bar, wuppie fluppie!
::::

^D
[ Div
    ( "" , [ "caution" ] , [] )
    [ Div ( "" , [ "title" ] , [] ) [ Plain [ Str "Caution" ] ]
    , Plain
        [ Str "Foo"
        , Space
        , Str "bar,"
        , Space
        , Str "wuppie"
        , Space
        , Str "fluppie!"
        ]
    ]
]

Activating lists_without_preceding_blankline the reader would emit a Plain instead of a Para, which would subsequently result in the Markdown writer failing to properly emit the GitHub alert, i.e. instead of

% pandoc -f markdown+alerts -t markdown+alerts                          
:::: caution
::: title
Caution
:::

Foo bar, wuppie fluppie!
::::

^D
> [!CAUTION]
> Foo bar, wuppie fluppie!

the writer would emit

% pandoc -f markdown+alerts+lists_without_preceding_blankline -t markdown+alerts
:::: caution
::: title
Caution
:::

Foo bar, wuppie fluppie!
::::

^D
:::: caution
::: title
Caution
:::

Foo bar, wuppie fluppie!
::::

(Pandoc 3.9 on macOS 26.3.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions