-
Notifications
You must be signed in to change notification settings - Fork 7
Description
background
Restructured text allow for the syntax:
.. note:: This is a short note
It is a nice, terse, one-line syntax for an admonition.
This comes at a price though; the parsing of a directive's "structure" is dependent on the type of directive.
Because the body content can possibly be on the first line, this does not work:
.. note:: I want a bespoke title
Then some content
It is simply treated as a note with two body paragraphs
This means you then have to then use a different directive 😒:
.. admonition:: I want a bespoke title
:class: note
Then some content
https://github.com/executablebooks/MyST-Parse currently follows this logic with colon_fence
, e.g.
:::{note} This is a body paragraph
this is a continuation of the same paragraph
:::
However, https://myst-tools.org/docs/mystjs/admonitions#admonition-titles does not
:::{note} This is the title
This is the body paragraph
:::
proposal
I propose "disambiguating" this difference, by introducing a "leaf div" to compliment the block "div"
::{note} This is a leaf div. It is interpreted as a single body paragraph,
that can continue on to multiple lines if really necessary
:::{note} this is a block div title
This is a block div content
:::
In executablebooks/mdit-py-plugins#72, I have sketched out what this would look like for a markdown-it plugin
Note with block attributes, you could also provide options to leaf divs, e.g. this
{#name .class key=value}
::{note} A note
would be equivalent to
:::{note}
:name: name
:class: class
:key: value
A note
:::