kaarmu / typst.vim

Vim plugin for Typst
MIT License
281 stars 24 forks source link

Don't italicize text if underscore is escaped #53

Closed Andrew15-5 closed 11 months ago

Andrew15-5 commented 12 months ago
Pop!\_OS

image

kaarmu commented 12 months ago

Some more similar bugs. Same for bold.

image

kaarmu commented 12 months ago

Will try to highlight the errors as I did in #47

yangwenbo99 commented 11 months ago

This version creates problems in texts like Sentence 1 @my_reference. Sentence 2.. In this example, all texts from _reference are highlighted as italic. Below is my current temporary fix on my machine:

syntax region typstMarkupItalicRegion
    \ contained
    \ matchgroup=typstMarkupItalicDelimiter start=/\(^\|[^0-9a-zA-Z]\)\@<=_/ end=/_\($\|[^0-9a-zA-Z]\)\@=/
    \ concealends contains=typstMarkupLabel,typstMarkupBold,@Spell