vim-pandoc / vim-pandoc-legacy

[UNSUPPORTED/use vim-pandoc/vim-pandoc] vim bundle for pandoc users
143 stars 23 forks source link

Incorrect underline with ~ #100

Closed naught101 closed 10 years ago

naught101 commented 10 years ago

I guess that there is a underline between double tilde characters like this to represent strikethough? There is a problem with this though, as it appears to also be triggering on single tildes, which is not part of the pandoc spec. Also, it appears to trigger for ~ that do not have a matching ~, which is annoying, because ~= is a useful symbol in some instances, and in makes the rest of the entire document underlined, and hard to read.

fmoralesc commented 10 years ago

Using the backport-pandoc-syntax the first issue is due to the fact that we underline all formatted blocks besides emphasis, bold and code. I decided for that because the conceals might be a tad subtle otherwise in the case of superscripts and subscripts. I'll try to figure a better default, but suggestions are very welcome.

The second issue is similar to a problem we had with _, I will look into applying the fix we used there to this case.

naught101 commented 10 years ago

Re: the first problem: according to the pandoc spec I linked to, ~this~ shouldn’t be formatted, only ~~this~~ should. So the former shouldn't be a formatted block at all, if I understand you correctly.

naught101 commented 10 years ago

And the same goes for underlines: __this__ should be underlined, but _this_ shouldn't. I think that fixing those problems would remove the vast majority of the second problem that I mentioned, since it'd be really rare that anyone would want two underscores or two tildes to print intentionally...

fmoralesc commented 10 years ago

~this~ should be a subscript, and thus a special formatted block (unfortunately, vim doesn't support underlined text by itself). Maybe it shouldn't be underlined, but simply concealing the ends of the region is too subtle a hint in many cases. Strikeouts, subscripts and superscripts are all underlined and have special marks: strikeouts have a "!", subscripts "ₙ", superscripts "ⁿ".

On your last comment: __this__ is bold text. _this_ is emphasized. There is no underline support in pandoc, according to the spec.

fmoralesc commented 10 years ago

Commit https://github.com/vim-pandoc/vim-pandoc-syntax/commit/77a8395b7716b00dd25c92eec52677deb57bfcfe in vim-pandoc-syntax fixes this issue (also, it makes underlines for strikeouts, subscripts and superscripts optional). I'll update the backport-pandoc-syntax branch when I can.