vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
425 stars 61 forks source link

Indented footnotes are highlighted as reference links #390

Closed ag-eitilt closed 5 months ago

ag-eitilt commented 5 months ago

I indent my reference link definitions and footnotes two spaces (not enough to trigger code-block formatting, but enough to make them visually distinct from running text if I'm somewhere without syntax highlighting), but while formatting works as expected for both if they start at column zero, the footnotes get highlighted according to the link pattern if the line starts with one through three spaces (after which the code-block kicks in[^1]):

Text with [two][] [links][] and two[^1] footnotes.[^2]

[two]: http://example.com/flush-link "Link title" {attrs=unhighlighted}
[^1]: Footnote "even with quotes", note the label punctuation is highlighted like its name

  [links]: http://example.com/indented-link "Link title" {attrs=unhighlighted}
  [^2]: Indented "and quoted" footnote, note the punctuation is unhighlighted but the "URL" and "link title" *are*.

Screenshot of the above block highlighted in NVim

I know I'm in the minority for using that indent, but it still feels like something that should be supported.

[^1]: Or at least it should; oddly if I indent the footnote to code block depth immediately after an indented line (such as a hard-wrapped paragraph) which is also indented (but not one at column 0), it's highlighted as a footnote again. I don't have a screenshot of that, and Github doesn't like the code block as part of this footnote, but: First line of paragraph.\n [^fake-footnote]: Pandoc actually reads this as normal text, but it's highlighted wrong.

ag-eitilt commented 5 months ago

Not sure what highlighting was kicking in since I had gone through and disabled all my other *.md syntax providers, but after a complete shutdown I've now actually got Pandoc highlighting and it does indeed render it all correctly. (The conceal characters people were talking about make a lot more sense now that they're actually collapsing as well...) Sorry for the confusion; this is still a valid issue somewhere, but it's not relevant for vim-pandoc-syntax.