markdown-preview.nvim icon indicating copy to clipboard operation
markdown-preview.nvim copied to clipboard

How to config mermaid.flowchartConfig?

Open BSDxxxx opened this issue 5 years ago • 4 comments

Adjust the width of the rendered flowchart:

mermaid.flowchartConfig = {
    width: 100%
}

BSDxxxx avatar May 10 '20 15:05 BSDxxxx

" options for markdown render
" mkit: markdown-it options for render
" katex: katex options for math
" uml: markdown-it-plantuml options
" maid: mermaid options
" disable_sync_scroll: if disable sync scroll, default 0
" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle'
"   middle: mean the cursor position alway show at the middle of the preview page
"   top: mean the vim top viewport alway show at the top of the preview page
"   relative: mean the cursor position alway show at the relative positon of the preview page
" hide_yaml_meta: if hide yaml metadata, default is 1
" sequence_diagrams: js-sequence-diagrams options
let g:mkdp_preview_options = {
    \ 'mkit': {},
    \ 'katex': {},
    \ 'uml': {},
    \ 'maid': {},
    \ 'disable_sync_scroll': 0,
    \ 'sync_scroll_type': 'middle',
    \ 'hide_yaml_meta': 1,
    \ 'sequence_diagrams': {},
    \ 'flowchart_diagrams': {}
    \ }

use above option

iamcco avatar May 13 '20 03:05 iamcco

@iamcco Didn't get it, can't see any settings related to my question. I have tried something like:

'maid' : {'width' : 100},

or

'maid' : {'width' : '100%'},

But none of these worked.

BSDxxxx avatar May 13 '20 03:05 BSDxxxx

It only support config by initialize function by now. http://mermaid-js.github.io/mermaid/#/usage?id=using-the-mermaidapiinitializemermaidinitialize-call

I don't know if this option can be pass to initialize.

iamcco avatar May 13 '20 03:05 iamcco

Here's one solution, add directives config using init:

```mermaid
%%{init: {'flowchart': {'useMaxWidth':false}}}%%


Check mermaid docs for directives

Another one, add maid config in the vim configuration(should work, but failed for me):

let g:mkdp_preview_options = {
    'maid': {"flowchart":{"useMaxWidth":"false"}}
    \}

Good luck.

sepmein avatar Jan 18 '21 10:01 sepmein

it doesn't work~~~

Iamvongao avatar Nov 15 '22 13:11 Iamvongao