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

Markdown highlighting inside Julia documentation block #267

Open
notinaboat opened this issue Jul 14, 2021 · 1 comment
Open

Markdown highlighting inside Julia documentation block #267

notinaboat opened this issue Jul 14, 2021 · 1 comment

Comments

@notinaboat
Copy link

image

The patch below adds highlighting inside Julia documentation block.
(first time editing a vim syntax file, so not sure if it's correct)

diff --git a/syntax/julia.vim b/syntax/julia.vim
index 9643792..044e41b 100644
--- a/syntax/julia.vim
+++ b/syntax/julia.vim
@@ -70,6 +70,15 @@ let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .

 syn case match

+syntax region juliadocCode matchgroup=juliadocCodeDelimiter start="`" end="`" concealends display oneline
+syntax region juliadocCode matchgroup=juliadocCodeDelimiter start="^\s*```.*$" end='^\s*```' concealends
+syntax region juliadocCode start="    \|\t" end="$" contained
+syntax region juliadocH1 matchgroup=juliadocHeadingDelimiter start="##\@!"      end="$" concealends display oneline
+syntax region juliadocH2 matchgroup=juliadocHeadingDelimiter start="###\@!"     end="$" concealends display oneline
+syntax region juliadocH3 matchgroup=juliadocHeadingDelimiter start="####\@!"    end="$" concealends display oneline
+syntax region juliadocH4 matchgroup=juliadocHeadingDelimiter start="#####\@!"   end="$" concealends display oneline
+syntax cluster juliaDocMarkdown     contains=juliadocCode,juliadocH1,juliadocH2,juliadocH3,juliadocH4
+
 syntax cluster juliaExpressions                contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems
 syntax cluster juliaExprsPrintf                contains=@juliaExpressions,@juliaPrintfItems

@@ -278,7 +287,7 @@ syntax region  juliatextString              matchgroup=juliaStringDelim start=+\<text\z("\("
 syntax region  juliahtmlString         matchgroup=juliaStringDelim start=+\<html\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
 syntax region  juliaint128String       matchgroup=juliaStringDelim start=+\<u\?int128\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw

-syntax region  juliaDocString          matchgroup=juliaDocStringDelim fold start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
+syntax region  juliaDocString          matchgroup=juliaDocStringDelim fold start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaDocMarkdown,juliaTodo,@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings

 exec 'syntax region  juliaPrintfMacro          contained transparent start="@s\?printf(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaPrintfParBlock'
 syntax region  juliaPrintfMacro                contained transparent start="@s\?printf\s\+" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExprsPrintf,juliaMacro,juliaSymbolS,juliaQuotedParBlockS
@storopoli
Copy link

Is there a PR for this?

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

2 participants