Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions _extensions/diagram/diagram.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,27 @@ local mermaid = {
return with_working_directory(tmpdir, function ()
local infile = 'diagram.mmd'
local outfile = 'diagram.' .. file_extension
local args = {"--pdfFit", "--input", infile, "--output", outfile}
if self.opt then
if self.opt.theme then
table.insert(args, '--theme' .. stringify(self.opt.theme))
table.insert(args, stringify(self.opt.cssFile))
end
if self.opt.configFile then
table.insert(args, '--configFile')
table.insert(args, stringify(self.opt.configFile))
end
if self.opt.cssFile then
table.insert(args, '--cssFile' .. stringify(self.opt.cssFile))
table.insert(args, stringify(self.opt.cssFile))
end
if self.opt.puppeteerConfigFile then
table.insert(args, '--puppeteerConfigFile')
table.insert(args, stringify(self.opt.puppeteerConfigFile))
end
end
write_file(infile, code)
pipe(
self.execpath or 'mmdc',
{"--pdfFit", "--input", infile, "--output", outfile},
''
)
pipe(self.execpath or 'mmdc', args,'')
return read_file(outfile), mime_type
end)
end)
Expand Down
13 changes: 13 additions & 0 deletions test/input-mermaid.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ Mermaid is a JavaScript-based diagramming and charting tool.
``` mermaid
%%| filename: flowchart
%%| fig-cap: A simple flowchart.
%%{
init: {
'theme': 'base',
'themeVariables': {
'primaryColor': '#BB2528',
'primaryTextColor': '#fff',
'primaryBorderColor': '#7C0000',
'lineColor': '#F8B229',
'secondaryColor': '#006100',
'tertiaryColor': '#fff'
}
}
}%%
graph TD;
A-->B;
A-->C;
Expand Down
6 changes: 5 additions & 1 deletion test/test-mermaid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ to: html
metadata:
pagetitle: Mermaid diagram
diagram:
cache: false
engine:
mermaid:
execpath: /usr/local/bin/mmdc
puppeteerConfigFile: /etc/puppeteer-conf.json
variables:
document-css: false
embed-resources: true
Loading