marshallward / vim-restructuredtext

Syntax file for reStructuredText on Vim.
26 stars 12 forks source link

footnotes need to be preceded by a space #21

Closed anntzer closed 7 years ago

anntzer commented 7 years ago

In

foo[1]_

foo [2]_

.. [1] bar

.. [2] bar

only [2] gets rendered as a footnote, not [1] -- but rst.vim highlights both of them as footnotes.

This behavior is documented at http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#footnote-references:

Inline markup recognition rules may require whitespace in front of the footnote reference.

Footnotes (and citations) should probably just be defined using the s:DefineInlineMarkup scheme in rst.vim.

marshallward commented 7 years ago

I think the DefineInlineMarkup cases are designed to support other non-space tokens like quotes:

Hello "*oh my*"

But otherwise I agree. Will try to implement it now.

marshallward commented 7 years ago

This should be fixed in the master branch now. We now check for either whitespace or the beginning of the line. Can you think of any other cases? (The whole inline section of the spec is a bit of a challenge to get through!)

anntzer commented 7 years ago

Seems to work for me. I agree the spec is a bit ridiculously complicated and it's not really worth implementing all of it, but I feel this was definitely a case where a good highlighter can help one catch a wrong markup early. As usual, thanks for the quick reply!