mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
#847 fix for case texts with multiple br tags, explanation in usage doc on how to avoid labels out of bounds.
This commit is contained in:
8
dist/index.html
vendored
8
dist/index.html
vendored
@@ -5,6 +5,12 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<title>Mermaid Quick Test Page</title>
|
<title>Mermaid Quick Test Page</title>
|
||||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
|
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
|
||||||
|
<style>
|
||||||
|
div.mermaid {
|
||||||
|
/* font-family: 'trebuchet ms', verdana, arial; */
|
||||||
|
font-family: 'Courier New', Courier, monospace !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="mermaid">
|
<div class="mermaid">
|
||||||
@@ -127,7 +133,7 @@
|
|||||||
<div class="mermaid">
|
<div class="mermaid">
|
||||||
graph TD
|
graph TD
|
||||||
A[Christmas] -->|Get money| B(Go shopping)
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
B --> C{Let me thinksssss<br/>ssssssssssssssssssssss<br/>sssssssssssssssssssssssssss}
|
B --> C{Let me thinksssssx<br/>sssssssssssssssssssuuu<br />tttsssssssssssssssssssssss}
|
||||||
C -->|One| D[Laptop]
|
C -->|One| D[Laptop]
|
||||||
C -->|Two| E[iPhone]
|
C -->|Two| E[iPhone]
|
||||||
C -->|Three| F[Car]
|
C -->|Three| F[Car]
|
||||||
|
@@ -96,8 +96,14 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Not doing so will most likely result in mermaid rendering graphs that have labels out of bounds. The default integration
|
Not doing so will most likely result in mermaid rendering graphs that have labels out of bounds. The default integration in mermaid uses the window.load event to start rendering. Also note that when rendering the width of lebale sare calucated of what width it bening meassured at the time.
|
||||||
in mermaid uses the window.load event to start rendering.
|
|
||||||
|
If your page has other fonts in its body those might be used instead of the mermaid font. Specifying the font in your styling is a workaround for this.
|
||||||
|
```
|
||||||
|
div.mermaid {
|
||||||
|
font-family: 'trebuchet ms', verdana, arial;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Calling `mermaid.init`
|
### Calling `mermaid.init`
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ const sanitize = text => {
|
|||||||
let txt = text
|
let txt = text
|
||||||
if (config.securityLevel === 'strict') {
|
if (config.securityLevel === 'strict') {
|
||||||
txt = txt.replace(/<br>/g, '#br#')
|
txt = txt.replace(/<br>/g, '#br#')
|
||||||
txt = txt.replace(/<br\S*\/>/g, '#br#')
|
txt = txt.replace(/<br\S*?\/>/g, '#br#')
|
||||||
txt = txt.replace(/</g, '<').replace(/>/g, '>')
|
txt = txt.replace(/</g, '<').replace(/>/g, '>')
|
||||||
txt = txt.replace(/#br#/g, '<br/>')
|
txt = txt.replace(/#br#/g, '<br/>')
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user