You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the grammar parses the attributes after the language ID for a code fence as a single token with the scope fenced_code.block.language.attributes.markdown:
```sh {higlight="content:~/$foo"}
cd~/$foo```
It would be more readable/useful to be able to parse this a little further:
{ is the punctuation that begins the attributes
highlight is an attribute name
= is an assignment operator
"content:~/$foo" is an attribute value and a string
} is the punctuation that ends the attributes
There's some commonly used syntax where .foo indicates a CSS class and #bar indicates an HTML ID, but otherwise I think the primary scopes are:
{ and } for beginning and ending punctuation
attribute names may be either standalone, like { disabled } or name-value pair, like { attrName="attrValue" }
= is the assignment operator for an attribute name-value pair
Values must be boolean true/false, numeric, or a quoted string1
I don't know enough about scope naming definitions to have good suggestions for the scopes to define, I just know enough to have noticed this limitation for the grammar.
Footnotes
There are a few Markdown parsers that support complex data types here, like arrays in [] or objects in {}, but I think that's probably too complex to get into, at least on a first pass. ↩
The text was updated successfully, but these errors were encountered:
It is worth noting that MkDocs doesn't support that syntax. It is fairly lenient with the requirements of curly braces and period on the language class, but when the language definition is combined with other classes, then its quite strict:
the curly braces and dot are required for all classes, including the language class if more than one class is defined
An example, compliant with MkDocs would be
``` bash
# Some comment
echo "Hello World"
```
``` .bash
# Some comment
echo "Hello World"
```
``` { .bash }
# Some comment
echo "Hello World"
```
``` { .bash .class #id title="Title of the code block" }
# Some comment
echo "Hello World"
```
Currently, the grammar parses the attributes after the language ID for a code fence as a single token with the scope
fenced_code.block.language.attributes.markdown
:It would be more readable/useful to be able to parse this a little further:
{
is the punctuation that begins the attributeshighlight
is an attribute name=
is an assignment operator"content:~/$foo"
is an attribute value and a string}
is the punctuation that ends the attributesThere's some commonly used syntax where
.foo
indicates a CSS class and#bar
indicates an HTML ID, but otherwise I think the primary scopes are:{
and}
for beginning and ending punctuation{ disabled }
or name-value pair, like{ attrName="attrValue" }
=
is the assignment operator for an attribute name-value pairtrue
/false
, numeric, or a quoted string1I don't know enough about scope naming definitions to have good suggestions for the scopes to define, I just know enough to have noticed this limitation for the grammar.
Footnotes
There are a few Markdown parsers that support complex data types here, like arrays in
[]
or objects in{}
, but I think that's probably too complex to get into, at least on a first pass. ↩The text was updated successfully, but these errors were encountered: