gpanders / vim-medieval

Evaluate Markdown code blocks within Vim
MIT License
164 stars 8 forks source link

[Question] is it possible to use it for vimwiki #15

Open MartyLake opened 2 weeks ago

MartyLake commented 2 weeks ago

Hello,

vimwiki uses codeblocks like this

{{{sh
echo hello world
}}}

and comments like this

% this is a comment

Is it possible to configure vim-medieval to support this format ? Best,

gpanders commented 2 weeks ago

It should be possible by adding an entry to g:medieval_fences. See the docs here: https://github.com/gpanders/vim-medieval/blob/master/doc/medieval.txt#L304

MartyLake commented 6 days ago

Thanks for your answer.

I tried those settings:

Plugin 'gpanders/vim-medieval'
let g:medieval_langs = ['python=python3', 'ruby', 'sh', 'console=bash', 'bash']
let g:medieval_fences = [
      \    { 'start': "```", 'end': "```" },
      \    { 'start': "$$", 'end': "$$" },
      \    { 'start': '{{<\s\+\(\S\+\)\s\+>}}', 'end': '{{<\s\+/\1\s\+>}}' },
      \    { 'start': "{{{", 'end': "}}}" }
      \]

and with this test file "test.txt", of filetype "vimwiki", attached because markdown inside markdown does not look pretty: test.txt

Apart from the markdown fences, all other types give me Closing fence not found. Do you have some working example I could compare to ?

Do you know how to fix this ?

gpanders commented 4 days ago

Ah I misremembered: the g:medieval_fences option only specifies patterns to use for "target" blocks, like this:

<!-- name: vimwiki-fences -->
{{{
}}}

But for "source" blocks that have the target annotation, we currently hard code only ``` and ~~~.