Skip to content

Admonition title syntax is not consistent with other implementation #93

Closed
@randomstuff

Description

@randomstuff

Describe the bug

context

The admonition syntax is based on Python Markdown:

!!! danger "Don't try this at home"
    ...

expectation

I would expect the quotes to be absent from the output.

bug

With mdit-py-plugins, the quotes are present in the output:

image

Unexpected output generated by mdit-py-plugins (spurious quotes):

<div class="admonition danger"> <p class="admonition-title">"Don't try this at home"</p> <p>...</p> </div>

Moreover, the additional CSS classes are not supported either.

Changing the behavior might cause compatiblity issues with markdown-it-admon however.

problem

This is a problem for people migrating from Python Markdown.

Reproduce the bug

Create markdown file with:

!!! danger "Don't try this at home"
    ...

Create script

from markdown_it import MarkdownIt
from mdit_py_plugins.admon import admon_plugin

md_opts = {
    "html": True,
}

markdown_it_render = MarkdownIt("commonmark", md_opts).use(admon_plugin)

source = open("/dev/stdin", "rt").read()
res = markdown_it_render.render(source)
print(res)

Run:

python3 test.py < test.md

Output:

<div class="admonition danger">
<p class="admonition-title">&quot;Don't try this at home&quot;</p>
<p>...</p>
</div>

List your environment

  • Python 3.11.4
  • Debian Linux
  • markdown-it-py==3.0.0
  • mdit-py-plugins==0.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions