Merge branch 'develop' into minmaps

This commit is contained in:
Knut Sveidqvist 2022-09-05 15:35:24 +02:00 committed by GitHub
commit df7b5965c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 44 deletions

View File

@ -10,10 +10,6 @@
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"
rel="stylesheet"
/>
<style>
body {
/* background: rgb(221, 208, 208); */
@ -42,10 +38,24 @@
</style>
</head>
<body>
<pre class="mermaid" style="width: 50%">
mindmap
[apa]
))bapa((
<pre class="mermaid2" style="width: 50%">
flowchart LR
classDef aPID stroke:#4e4403,fill:#fdde29,color:#4e4403,rx:5px,ry:5px;
classDef crm stroke:#333333,fill:#DCDCDC,color:#333333,rx:5px,ry:5px;
classDef type stroke:#502604,fill:#FAB565,color:#502604,rx:20px,ry:20px;;
O0("Joe")
class O0 aPID;
O1("Person")
class O1 crm;
O0 -- has type -->O1["Person"]
O2("aat:300411314")
class O2 type;
click O2 function "Sorry the newline html tags are not being processed correctly<br/> So all of this appears on the <br/> same line."
O0 -- has type -->O2["Bug"]
click O0 function "Lots of great info about Joe<br>Lots of great info about Joe<br>burt<br>fred";
</pre>
<pre class="mermaid2" style="width: 50%">
flowchart TD
@ -60,15 +70,21 @@ flowchart TD
G --> H
end
end
</pre>
<pre class="mermaid" style="width: 50%">
flowchart TD
id
</pre>
<pre class="mermaid2" style="width: 50%">
flowchart LR
a["<strong>Haiya</strong>"]===>b
</pre
>
<div class="mermaid2" style="width: 50%">flowchart TD A --> B A --> C B --> C</div>
</pre>
<pre class="mermaid2" style="width: 50%">
flowchart TD
A --> B
A --> C
B --> C
</pre>
<pre class="mermaid2" style="width: 50%">
flowchart TD
A([stadium shape test])
@ -83,11 +99,16 @@ flowchart TD
class A someclass;
class C someclass;
</pre>
<div class="mermaid2" style="width: 50%">
sequenceDiagram title: My Sequence Diagram Title accTitle: My Acc Sequence Diagram accDescr:
My Sequence Diagram Description Alice->>John: Hello John, how are you? John-->>Alice: Great!
<pre class="mermaid2" style="width: 50%">
sequenceDiagram
title: My Sequence Diagram Title
accTitle: My Acc Sequence Diagram
accDescr: My Sequence Diagram Description
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
</div>
</pre>
<pre class="mermaid2" style="width: 50%">
graph TD
A -->|000| B
@ -95,7 +116,7 @@ graph TD
linkStyle 1 stroke:#ff3,stroke-width:4px,color:red;
</pre>
<pre class="mermaid" style="width: 100%">
<pre class="mermaid2" style="width: 100%">
journey
accTitle: My User Journey Diagram
accDescr: My User Journey Diagram Description
@ -323,12 +344,6 @@ flowchart TD
htmlLabels: false,
fontFamily: 'courier',
},
fontSize: 18,
curve: 'cardinal',
// securityLevel: 'sandbox',
// themeVariables: {relationLabelColor: 'red'}
// theme: 'dark',
wrap: true,
});
function callback() {
alert('It worked');

View File

@ -79,13 +79,13 @@ Theme , the CSS style sheet
**Notes**:
- **strict**: (**default**) tags in text are encoded, click functionality is disabled
- **loose**: tags in text are allowed, click functionality is enabled
- **antiscript**: html tags in text are allowed, (only script element is removed), click
functionality is enabled
- **sandbox**: With this security level all rendering takes place in a sandboxed iframe. This
prevent any JavaScript from running in the context. This may hinder interactive functionality
of the diagram like scripts, popups in sequence diagram or links to other tabs/targets etc.
- **strict**: (**default**) tags in text are encoded, click functionality is disabled
- **loose**: tags in text are allowed, click functionality is enabled
- **antiscript**: html tags in text are allowed, (only script element is removed), click
functionality is enabled
- **sandbox**: With this security level all rendering takes place in a sandboxed iframe. This
prevent any JavaScript from running in the context. This may hinder interactive functionality
of the diagram like scripts, popups in sequence diagram or links to other tabs/targets etc.
## startOnLoad
@ -1450,7 +1450,7 @@ corresponding siteConfig value.
### Parameters
- `conf` **any** The potential currentConfig
- `conf` **any** The potential currentConfig
Returns **any** The currentConfig merged with the sanitized conf
@ -1515,7 +1515,7 @@ Pushes in a directive to the configuration
### Parameters
- `directive` **[object][5]** The directive to push in
- `directive` **[object][5]** The directive to push in
## reset
@ -1545,7 +1545,7 @@ Returns **void**
- `options` **MermaidConfig**
##
##
## mermaidAPI configuration defaults
@ -1610,15 +1610,9 @@ Returns **void**
```
[1]: https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js
[2]: Setup.md?id=render
[3]: 8.6.0_docs.md
[4]: #mermaidapi-configuration-defaults
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[7]: https://developer.mozilla.org/docs/Web/API/Element

View File

@ -30,7 +30,6 @@ export class Diagram {
const error = { str, hash };
throw error;
};
this.db.clear();
this.parse(this.txt, parseError);
}

View File

@ -213,6 +213,7 @@ export interface RequirementDiagramConfig extends BaseDiagramConfig {
rect_padding?: number;
line_height?: number;
}
export interface MindmapDiagramConfig extends BaseDiagramConfig {
useMaxWidth: boolean;
padding: number;

View File

@ -6,6 +6,7 @@ import mindmapParser from '../diagrams/mindmap/parser/mindmap';
import { mindmapDetector } from '../diagrams/mindmap/mindmapDetector';
import mindmapStyles from '../diagrams/mindmap/styles';
import gitGraphDb from '../diagrams/git/gitGraphAst';
import gitGraphRenderer from '../diagrams/git/gitGraphRenderer';
// @ts-ignore

View File

@ -0,0 +1,5 @@
import { DiagramDetector } from '../../diagram-api/detectType';
export const mindmapDetector: DiagramDetector = (txt) => {
return txt.match(/^\s*mindmap/) !== null;
};

View File

@ -42,7 +42,6 @@ const init = function (
try {
initThrowsErrors(config, nodes, callback);
} catch (e) {
console.error('Syntax Error rendering');
log.warn('Syntax Error rendering');
if (isDetailedError(e)) {
log.warn(e.str);
@ -128,8 +127,7 @@ const initThrowsErrors = function (
element
);
} catch (error) {
console.error('Catching Error (bootstrap)', error);
log.warn('Catching Error (bootstrap)');
log.warn('Catching Error (bootstrap)', error);
// @ts-ignore
// TODO: We should be throwing an error object.
throw { error, message: error.str };