mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 09:03:02 +08:00
Do not duplicate <br> tags inside Mermaid graphs
This commit is contained in:
parent
f01e212c0a
commit
d89e92185a
1 changed files with 8 additions and 1 deletions
|
@ -83,7 +83,14 @@ class Markdown {
|
||||||
.use(rehypeKatex)
|
.use(rehypeKatex)
|
||||||
.use(rehypeMermaid)
|
.use(rehypeMermaid)
|
||||||
.use(rehypeExternalLinks, { baseUrl: this.baseUrl })
|
.use(rehypeExternalLinks, { baseUrl: this.baseUrl })
|
||||||
.use(rehypeStringify)
|
.use(rehypeStringify, {
|
||||||
|
// Mermaid allows HTML tags, such as <br /> in diagram labels.
|
||||||
|
// We parse the SVG earlier, then stringify it, closeEmptyElements
|
||||||
|
// makes sure we emit <br /> as a self-closing tag, rather than
|
||||||
|
// <br></br> (which the browser would interpret as two breaks).
|
||||||
|
// See https://github.com/syntax-tree/hast-util-to-html/blob/9d7a2f7d63ec2d11b3ae5a5e4201181fdeedf6ea/lib/handle/element.js#L66-L69
|
||||||
|
closeEmptyElements: true,
|
||||||
|
})
|
||||||
.process(this.content)
|
.process(this.content)
|
||||||
.then((file) => String(file))
|
.then((file) => String(file))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
Loading…
Reference in a new issue