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" href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet" rel="stylesheet"
/> />
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"
rel="stylesheet"
/>
<style> <style>
body { body {
/* background: rgb(221, 208, 208); */ /* background: rgb(221, 208, 208); */
@ -42,10 +38,24 @@
</style> </style>
</head> </head>
<body> <body>
<pre class="mermaid" style="width: 50%"> <pre class="mermaid2" style="width: 50%">
mindmap flowchart LR
[apa] classDef aPID stroke:#4e4403,fill:#fdde29,color:#4e4403,rx:5px,ry:5px;
))bapa(( 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>
<pre class="mermaid2" style="width: 50%"> <pre class="mermaid2" style="width: 50%">
flowchart TD flowchart TD
@ -60,15 +70,21 @@ flowchart TD
G --> H G --> H
end end
end end
</pre> </pre>
<pre class="mermaid" style="width: 50%">
flowchart TD
id
</pre>
<pre class="mermaid2" style="width: 50%"> <pre class="mermaid2" style="width: 50%">
flowchart LR flowchart LR
a["<strong>Haiya</strong>"]===>b a["<strong>Haiya</strong>"]===>b
</pre </pre>
> <pre class="mermaid2" style="width: 50%">
<div class="mermaid2" style="width: 50%">flowchart TD A --> B A --> C B --> C</div> flowchart TD
A --> B
A --> C
B --> C
</pre>
<pre class="mermaid2" style="width: 50%"> <pre class="mermaid2" style="width: 50%">
flowchart TD flowchart TD
A([stadium shape test]) A([stadium shape test])
@ -83,11 +99,16 @@ flowchart TD
class A someclass; class A someclass;
class C someclass; class C someclass;
</pre> </pre>
<div class="mermaid2" style="width: 50%"> <pre class="mermaid2" style="width: 50%">
sequenceDiagram title: My Sequence Diagram Title accTitle: My Acc Sequence Diagram accDescr: sequenceDiagram
My Sequence Diagram Description Alice->>John: Hello John, how are you? John-->>Alice: Great! 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! Alice-)John: See you later!
</div> </pre>
<pre class="mermaid2" style="width: 50%"> <pre class="mermaid2" style="width: 50%">
graph TD graph TD
A -->|000| B A -->|000| B
@ -95,7 +116,7 @@ graph TD
linkStyle 1 stroke:#ff3,stroke-width:4px,color:red; linkStyle 1 stroke:#ff3,stroke-width:4px,color:red;
</pre> </pre>
<pre class="mermaid" style="width: 100%"> <pre class="mermaid2" style="width: 100%">
journey journey
accTitle: My User Journey Diagram accTitle: My User Journey Diagram
accDescr: My User Journey Diagram Description accDescr: My User Journey Diagram Description
@ -323,12 +344,6 @@ flowchart TD
htmlLabels: false, htmlLabels: false,
fontFamily: 'courier', fontFamily: 'courier',
}, },
fontSize: 18,
curve: 'cardinal',
// securityLevel: 'sandbox',
// themeVariables: {relationLabelColor: 'red'}
// theme: 'dark',
wrap: true,
}); });
function callback() { function callback() {
alert('It worked'); alert('It worked');

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@ import mindmapParser from '../diagrams/mindmap/parser/mindmap';
import { mindmapDetector } from '../diagrams/mindmap/mindmapDetector'; import { mindmapDetector } from '../diagrams/mindmap/mindmapDetector';
import mindmapStyles from '../diagrams/mindmap/styles'; import mindmapStyles from '../diagrams/mindmap/styles';
import gitGraphDb from '../diagrams/git/gitGraphAst'; import gitGraphDb from '../diagrams/git/gitGraphAst';
import gitGraphRenderer from '../diagrams/git/gitGraphRenderer'; import gitGraphRenderer from '../diagrams/git/gitGraphRenderer';
// @ts-ignore // @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 { try {
initThrowsErrors(config, nodes, callback); initThrowsErrors(config, nodes, callback);
} catch (e) { } catch (e) {
console.error('Syntax Error rendering');
log.warn('Syntax Error rendering'); log.warn('Syntax Error rendering');
if (isDetailedError(e)) { if (isDetailedError(e)) {
log.warn(e.str); log.warn(e.str);
@ -128,8 +127,7 @@ const initThrowsErrors = function (
element element
); );
} catch (error) { } catch (error) {
console.error('Catching Error (bootstrap)', error); log.warn('Catching Error (bootstrap)', error);
log.warn('Catching Error (bootstrap)');
// @ts-ignore // @ts-ignore
// TODO: We should be throwing an error object. // TODO: We should be throwing an error object.
throw { error, message: error.str }; throw { error, message: error.str };