Skip to content

Commit

Permalink
WIP: adding raw svg output
Browse files Browse the repository at this point in the history
  • Loading branch information
raghur committed Dec 21, 2023
1 parent ff37900 commit f029a15
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ function mermaid(type, value, _format, _meta) {
if (options.loc == 'inline') {
if (options.format === 'svg') {
var data = fs.readFileSync(savePath, 'utf8')
newPath = "data:image/svg+xml;base64," + Buffer.from(data).toString('base64');
// newPath = "data:image/svg+xml;base64," + Buffer.from(data).toString('base64');


// does not use default theme - picks the forest theme in the test.md
return pandoc.RawBlock('html', data);
} else if (options.format === 'pdf') {
newPath = savePath
} else {
Expand All @@ -109,14 +113,16 @@ function mermaid(type, value, _format, _meta) {

var imageClasses = options.imageClass ? [options.imageClass] : []

if (options.loc == 'inline' && options.format === 'svg') {
}
return pandoc.Para(
[
pandoc.Image(
[id, imageClasses, []],
[pandoc.Str(options.caption)],
[newPath, fig]
)
]);
]);
}

function externalTool(command) {
Expand Down

0 comments on commit f029a15

Please sign in to comment.