Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Commit

Permalink
Adding custom CSS to the internal SVG stylesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerj committed Nov 7, 2017
1 parent 1f9a6bc commit 141a006
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ backgroundColor = backgroundColor || 'white'
;(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
page.on('console', msg => console.log('PAGE LOG:', ...msg.args));
page.setViewport({ width, height })
await page.goto(`file://${path.join(__dirname, 'index.html')}`)

Expand All @@ -78,7 +79,7 @@ backgroundColor = backgroundColor || 'white'
const definition = fs.readFileSync(input, 'utf-8')

var myconfig, myCSS

if (configFile) {
myconfig = JSON.parse(fs.readFileSync(configFile, 'utf-8'))
}
Expand Down Expand Up @@ -111,6 +112,11 @@ backgroundColor = backgroundColor || 'white'
}

window.mermaid.init(undefined, container)

if (myCSS) {
window.document.getElementById('mermaidChart0').getElementsByTagName('style')[0].innerHTML = myCSS;
}

}, definition, theme, myconfig, myCSS)

if (output.endsWith('svg')) {
Expand Down

0 comments on commit 141a006

Please sign in to comment.