Add specification for info strings with inline code#750
Add specification for info strings with inline code#750tgross35 wants to merge 1 commit intocommonmark:masterfrom
Conversation
Add RST-style colon-delimited info strings to inline code
:python:`foo("abc", a=123)`
|
This conflicts with emoji shortcodes such as used on here on GH, and likely conflicts with the generic directive proposal, which is in several popular projects such as markdown-it and the things I work on (micromark, remark, mdx, markdown-rs) |
|
Good point, that is unfortunate. Do you have a better suggestion, or should this just be dropped? Maybe something like |
|
Hmm. Tough!
Fenced code supports multiple words, and it puts the thing after the opening backticks. So perhaps we could do something with So like, if you start the code with a special starting sequence ( Definitely not sure tho! |
|
This certainly isn't appropriate for the core specification. I think several implementations support postfixed attributes inside curly braces: `foo("abc", a=123)`{python} |
|
Pandoc has always supported a consistent attribute syntax for both code blocks and inline code. Note: the This is what I would have preferred for commonmark, too, and I argued for it, but some of the others involved preferred to be less opinionated about the "info string." |
Could you elaborate on this? It came up in discussion at #745 where discussion was about adding some way to specify math inline |
I wonder if a combination of @jgm's mention and current link syntax would work to be less programmy.
I think I saw this discussed somewhere at some point, I'll try to dig up the thread I don't have any idea what a strong enough separator would be, almost every sigil is used in some language or other.
Tricky question! |
|
I actually like We can make it even safer by only accepting one single word (relaxed with |
|
This wouldn't be backwards compatible but something in the wild is Typst, which allows you to use info strings in multi-backtick inlines only. |
|
Yeah, the Typst-based syntax seems like the most intuitive option for Markdown IMO. No change of existing syntax, really, except for an expansion of how it can be used. EDIT: Sorry, missed that it wouldn't be backwards-compatible. That's unfortunate. |
This adds RST-style colon-delimited info strings to inline code, which can be used for code highlighting
This takes inspiration from RST roles.