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

Extend definition lists to support admonitions #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Extend definition lists to support admonitions #126

wants to merge 1 commit into from

Conversation

toonetown
Copy link

This PR allows you to define an admonition by using the syntax found at https://pythonhosted.org/Markdown/extensions/admonition.html. The difference between this implementation and the one described on pythonhosted is this implementation uses definition lists instead of nested paragraphs. Also, if you specify and empty string for the title, the generated <dt> element will still be generated, but will be empty.

The added classes are admonition and xxx - whatever you set the admonition as.

Also, if you do not provide a term, then Xxx will be used as the term. The first letter will be capitalized, and any underscores will be replaced with spaces. This allows you to define, for example:

!!!my_note
     This is my note

And it will be turned into:

<dl class="admonition my_note">
    <dt>My note</dt>
    <dd>This is my note</dd>
</dl>

If you define a term after the admonition annotation, then the term is used instead (without the admonition). So, for example:

!!! warning "Be Careful" !!!
:   This is a dangerous thing to do

Will be turned into:

<dl class="admonition warning">
    <dt>Be Careful</dt>
    <dd>This is a dangerous thing to do</dd>
</dl>

Note that the trailing triple exclamation point is optional, but can be used (similar to the # for headers) to balance out the way the line looks.

Non-HTML formats will just output their information as a definition list.

There are also unit tests added to the MarkdownTest repository (see fletcher/MMD-Test-Suite#7)

@toonetown
Copy link
Author

If this feature is still not desired (as mentioned by @fletcher in issue #125), feel free to just close the PR (and also MMD-Test-Suite#7).

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

Successfully merging this pull request may close these issues.

None yet

1 participant