jupyter-book / myst-enhancement-proposals

MyST Enhancement Proposals (MEPs)
https://mep.mystmd.org
MIT License
8 stars 3 forks source link

Inline & block attributes #11

Open rowanc1 opened 1 year ago

rowanc1 commented 1 year ago

There has been a lot of discussion dating back to 2019/2020 on how to add options to roles, and easier/faster ways to add options to directives.

For example:

There is recent work in the python parser on bringing in djot/pandoc style inline & block attributes. Which is a really helpful and standardized concept.

I think that we should aim to discuss how we adopt this in the myst-spec and across all myst projects. There is some initial work at implementations here:

I think from a MEP perspective we could aim to add block & inline attributes, address the conflict with (targets)=. I think a future MEP could aim to resolve how directives and roles integrate with this feature. For example, after the inclusion of block syntax, we would support something like:

{.dropdown}
:::{admonition} Title
Body
:::

However, there are many different ways we could combine these as we modify MyST syntax to resolve some of the redundancy that this allows.

Suggested MEPs: 1) add block syntax (e.g. above any element, how they combine, etc.) 2) add inline role attributes syntax (e.g. only on images, spans, code etc, not any words), builds on (1) 3) discuss how to rationalize the new syntax with directives, engaging the djot community (ideally) along the way

@chrisjsewell can you add any other context/pointers please?!

chrisjsewell commented 1 year ago

address the conflict with (targets)=

A very quick thing I noted recently, since attributes only recognize (\W_:-) (https://github.com/jgm/djot.js/blob/8544a3646add6640ef647c61d629c5d4978207a7/src/attributes.ts#L97)

(target/forwardslash)=
# This works

{#target/forwardslash}
# This does not

which is a bit of an issue, at least for back-compatibility, because I at least have used / in a lot of target names 😅