mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-06 09:06:45 +02:00
refactor(katex): revision changes
This commit is contained in:
@@ -62,41 +62,41 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
accTitle: Sequence diagram title is here
|
accTitle: Sequence diagram title is here
|
||||||
accDescr: Hello friends
|
accDescr: Hello friends
|
||||||
|
|
||||||
participant Alice
|
participant Alice
|
||||||
participant Bob
|
participant Bob
|
||||||
participant John as John<br />Second Line
|
participant John as John<br />Second Line
|
||||||
rect rgb(200, 220, 100)
|
rect rgb(200, 220, 100)
|
||||||
rect rgb(200, 255, 200)
|
rect rgb(200, 255, 200)
|
||||||
Alice ->> Bob: Hello Bob, how are you?
|
Alice ->> Bob: Hello Bob, how are you?
|
||||||
Bob-->>John: How about you John?
|
Bob-->>John: How about you John?
|
||||||
end
|
end
|
||||||
Bob--x Alice: I am good thanks!
|
Bob--x Alice: I am good thanks!
|
||||||
Bob-x John: I am good thanks!
|
Bob-x John: I am good thanks!
|
||||||
Note right of John: John thinks a long<br />long time, so long<br />that the text does<br />not fit on a row.
|
Note right of John: John thinks a long<br />long time, so long<br />that the text does<br />not fit on a row.
|
||||||
Bob-->Alice: Checking with John...
|
Bob-->Alice: Checking with John...
|
||||||
Note over John:wrap: John looks like he's still thinking, so Bob prods him a bit.
|
Note over John:wrap: John looks like he's still thinking, so Bob prods him a bit.
|
||||||
Bob-x John: Hey John - we're still waiting to know<br />how you're doing
|
Bob-x John: Hey John - we're still waiting to know<br />how you're doing
|
||||||
Note over John:nowrap: John's trying hard not to break his train of thought.
|
Note over John:nowrap: John's trying hard not to break his train of thought.
|
||||||
Bob-x John:wrap: John! Are you still debating about how you're doing? How long does it take??
|
Bob-x John:wrap: John! Are you still debating about how you're doing? How long does it take??
|
||||||
Note over John: After a few more moments, John<br />finally snaps out of it.
|
Note over John: After a few more moments, John<br />finally snaps out of it.
|
||||||
end
|
end
|
||||||
alt either this
|
alt either this
|
||||||
Alice->>John: Yes
|
Alice->>John: Yes
|
||||||
else or this
|
else or this
|
||||||
Alice->>John: No
|
Alice->>John: No
|
||||||
else or this will happen
|
else or this will happen
|
||||||
Alice->John: Maybe
|
Alice->John: Maybe
|
||||||
end
|
end
|
||||||
par this happens in parallel
|
par this happens in parallel
|
||||||
Alice -->> Bob: Parallel message 1
|
Alice -->> Bob: Parallel message 1
|
||||||
and
|
and
|
||||||
Alice -->> John: Parallel message 2
|
Alice -->> John: Parallel message 2
|
||||||
end
|
end
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
|
@@ -240,7 +240,7 @@ export const calculateMathMLDimensions = async (text: string, config: MermaidCon
|
|||||||
* @returns String containing MathML if KaTeX is supported, or an error message if it is not and stylesheets aren't present
|
* @returns String containing MathML if KaTeX is supported, or an error message if it is not and stylesheets aren't present
|
||||||
*/
|
*/
|
||||||
export const renderKatex = async (text: string, config: MermaidConfig): Promise<string> => {
|
export const renderKatex = async (text: string, config: MermaidConfig): Promise<string> => {
|
||||||
if ((hasKatex(text) && isMathMLSupported()) || (!isMathMLSupported() && config.legacyMathML)) {
|
if (hasKatex(text) && (isMathMLSupported() || config.legacyMathML)) {
|
||||||
// @ts-ignore @types/katex does not work
|
// @ts-ignore @types/katex does not work
|
||||||
const katex = (await import('katex')).default;
|
const katex = (await import('katex')).default;
|
||||||
return text
|
return text
|
||||||
|
Reference in New Issue
Block a user