Skip to content

Commit

Permalink
add parameter to specify the height of the diagram, fixing BoostIO#2335
Browse files Browse the repository at this point in the history
  • Loading branch information
daiyam committed Aug 25, 2018
1 parent 039f737 commit a591001
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions browser/components/render/MermaidRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function render (element, content, theme) {
})
mermaidAPI.render(getId(), content, (svgGraph) => {
element.innerHTML = svgGraph
element.style.height = element.attributes.getNamedItem('data-height').value + 'vh'
})
} catch (e) {
console.error(e)
Expand Down
2 changes: 1 addition & 1 deletion browser/lib/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Markdown {
return `<pre class="chart">${str}</pre>`
}
if (langType === 'mermaid') {
return `<pre class="mermaid">${str}</pre>`
return `<pre class="mermaid" data-height="${fileName}">${str}</pre>`
}
return '<pre class="code CodeMirror">' +
'<span class="filename">' + fileName + '</span>' +
Expand Down
6 changes: 5 additions & 1 deletion browser/styles/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,8 @@ modalmonokai()
width 100%
background-color $ui-monokai-backgroundColor
overflow hidden
border-radius $modal-border-radius
border-radius $modal-border-radius

pre.mermaid svg {
max-width 100% !important
}

0 comments on commit a591001

Please sign in to comment.