Skip to content

Commit

Permalink
resolves #1641 Mermaid background on span elements were missing (#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie authored Sep 23, 2023
1 parent 535598c commit fa9915d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion diagrams.net/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ export class Worker {
// const pageCount = parseInt(await page.mainFrame().$eval('#LoadingComplete', div => div.getAttribute('pageCount')))

if (task.isPng) {
await page.setContent(evalResult.svg)
await page.setContent(`<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
${evalResult.svg}
</body>
</html>`)
const container = await page.$('svg')
return await container.screenshot({
type: 'png',
Expand Down
11 changes: 10 additions & 1 deletion mermaid/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ async function toPNG (page, svg) {
'puppeteer'
)
try {
await page.setContent(svg)
await page.setContent(`<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
${svg}
</body>
</html>`)
const container = await page.$('#container')
const result = await container.screenshot({
type: 'png',
Expand Down

0 comments on commit fa9915d

Please sign in to comment.