Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to add vimwiki tags highlight group, conflict with pandocDefinitionBlock #364

Open
lyndhurst opened this issue Aug 26, 2021 · 0 comments

Comments

@lyndhurst
Copy link

Hi,
I am trying to make pandoc-syntax play nice with vimwiki. Part of it would be to add some highlighting to Vimwiki tags. Which is defined in the help as

A tag is a sequence of non-space characters between two colons:
:tag-example:
It is allowed to concatenate multiple tags in one line:
:tag-one:tag-two:

I simply got the regex from the vimwiki syntax file, and added to my .vimrc:

syn match myPandocWikiTags
                \ /\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@=/

It works fine except when I add a tag within the two first columns of a line, it turns the myPandocWikiTag into a pandocDefinitionBlock.

I suck at vimscript, and to make this task easier, at regex too :) With my little understanding, I imagine that the best course of action would be to redefine the pandocDefinitionBlock adding a rule to exclude any pattern where a second colon stands right after the first colon and any non space character.

Maybe I am wrong, and the vimwiki tag expression should be modified. Any help would be greatly appreciated, thanks.

I will paste the pandocDefinitionBlock expression from the syntax file below to make it easier for anyone who would like to help me to copy, and modify.

syn region pandocDefinitionBlock
    \ start=/^\%(\_^\s*\([`~]\)\1\{2,}\)\@!.*\n\(^\s*\n\)\=\s\{0,2}\([:~]\)\(\3\{2,}\3*\)\@!/
    \ skip=/\n\n\zs\s/
    \ end=/\n\n/
    \ contains=pandocDefinitionBlockMark,pandocDefinitionBlockTerm,pandocCodeBlockInsideIndent,pandocEmphasis,pandocStrong,pandocStrongEmphasis,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocFootnoteID,pandocReferenceURL,pandocReferenceLabel,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocEmDash,pandocEnDash,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant