Open anntzer opened 7 years ago
Taking rstEmphasis
(and presmably its cousins) out of rstCruft
seems to remove markup from directives. Currently, rstCruft
is also used inside of rstFootnote
, rstCitation
, rstTable
, and rstSimpleTable
.
As for whether we should be marking up directives? I guess that depends if the text is formatted or not. Tables, footnotes, and citations are certainly formatted. But I think directives would generally be undisplayed and not subject to reST rules.
I'm tempted to just remove rstCruft
entirely from directives, but I'm not yet sure of the consequences of that here.
Any thoughts on this?
Well, the problem is that e.g.
.. note:: foo *bar*
is a directive that includes markup, so you never know...
Perhaps an easier(?), partial fix is to only highlight markup where both the start and the end-delimiters are present? Note that rst2html (and others, I guess) will implicitly close an opened markup delimiter where the end delimiter is missing, but will display a warning while doing so.
OK, so some directives do actually need markup... but then others (like code) will go completely bonkers if it's used. I agree disabling markup within directives is a bad idea.
It might be good to whitelist (or blacklist) the directives which do (or don't) accept markup, but maybe that's a somewhat bigger project for another day.
In the meantime, I agree with you that terminating all highlight after end-string is the right move here. Unfortunately that comes up against my very limited vimL skills, but I'll have a go.
https://github.com/python/cpython/blob/master/Doc/library/subprocess.rst#using-the-modsubprocess-module contains the following snippet:
Currently, vim-rst highlights as italic everything from the first star (first line) to after
*args*
. After skimming through the rst spec, I believe that the function signature is a separate element (http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#directives)so while it may not be completely clear whether the directive argument should be subject to markup (it may actually depend on the directive itself...), at least the markup should stop by the end of the element.