Closed matoushs closed 5 years ago
I guess this issue should be moved to https://github.com/jgm/skylighting/
I just tried this in Kate and it appears to work there, so this might be an issue in skylighting rather than the markdown.xml syntax definition.
Relevant bits of trace output:
...
FALLTHROUGH Just (NormalTok,"Hi")
...
Trying rule Rule {rMatcher = RegExpr (RE {reString = "[\\d]+\\.\\s", reCaseSensitive = True}), rAttribute = NormalTok, rIncludeAttribute = False, rDynamic = False, rCaseSensitive = True, rChildren = [], rLookahead = False, rFirstNonspace = False, rColumn = Just 0, rContextSwitch = [Push ("Markdown","numlist")]}
RegExpr MATCHED Just (NormalTok,"1. ")
CONTEXT STACK ["numlist","Normal Text"]
FALLTHROUGH Just (StringTok," ")
etc.
As far as I can see, we're interpreting the syntax definition correctly. First we match on
<context attribute="Normal Text" lineEndContext="#stay" name="Normal Text">
<RegExpr context="numlist" String="^[\d]+\.\s"/>
Since the RegExpr
element has no attribute
, the parent attribute Normal Text
is used for what matches here (1.
). Then we switch to the "numlist" context and from then on everything has the String
attribute (which this definition uses for numbered lists).
But since Kate works, maybe there's a problem in my understanding of how this is supposed to be interpreted.
It's an easy matter to fix markdown.xml, but I'm still puzzled as to why Kate works.
The first list item marker inside a fenced code block is processed differently than the others. A list within a code block with a markdown class places the span after the first list marker (1.), but with other classes the list marker (1.) is placed as content in the tag.
I compiled the following code with: pandoc -f markdown -t html
This produces:
Ordered List - Markdown
Ordered List - Javscript
Enumerated List - Markdown
See that in the first and third examples the list marker "1." appears before the span, but in the second example it appears within the span. This produces correct syntax highlighting.
My setup is: macOS Mojave 10.14.5 pandoc 2.7.1