endfor
enddef
-export def ParseMarkdown(data: list<string>): dict<list<any>>
+export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>>
var document: dict<list<any>> = {content: [], syntax: []}
var open_blocks: list<dict<any>> = []
if line =~ thematic_break
CloseBlocks(document, open_blocks)
if &g:encoding == "utf-8"
- document.content->add({text: "\u2500"->repeat(80)})
+ document.content->add({text: "\u2500"->repeat(width)})
else
- document.content->add({text: "-"->repeat(80)})
+ document.content->add({text: "-"->repeat(width)})
endif
last_block = "hr"
continue
try
popup_id = bnr->getbufinfo()[0].popups[0]
- document = md.ParseMarkdown(bnr->getbufline(1, '$'))
+ document = md.ParseMarkdown(bnr->getbufline(1, '$'), winwidth(popup_id))
catch /.*/
b:markdown_fallback = v:true
finish