Upgraded mermaid and katex

This commit is contained in:
Benoit Schweblin 2018-09-19 17:28:03 +01:00
parent 2e832fd766
commit 6b91c2bafb
5 changed files with 4749 additions and 4834 deletions

View File

@ -53,11 +53,11 @@ module.exports = {
loader: 'babel-loader', loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/mermaid/src')], include: [resolve('src'), resolve('test'), resolve('node_modules/mermaid/src')],
exclude: [ exclude: [
resolve('node_modules/mermaid/src/diagrams/classDiagram/parser'), resolve('node_modules/mermaid/src/diagrams/class/parser'),
resolve('node_modules/mermaid/src/diagrams/flowchart/parser'), resolve('node_modules/mermaid/src/diagrams/flowchart/parser'),
resolve('node_modules/mermaid/src/diagrams/gantt/parser'), resolve('node_modules/mermaid/src/diagrams/gantt/parser'),
resolve('node_modules/mermaid/src/diagrams/gitGraph/parser'), resolve('node_modules/mermaid/src/diagrams/git/parser'),
resolve('node_modules/mermaid/src/diagrams/sequenceDiagram/parser'), resolve('node_modules/mermaid/src/diagrams/sequence/parser'),
], ],
}, },
{ {

8745
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
"dependencies": { "dependencies": {
"@vue/test-utils": "^1.0.0-beta.16", "@vue/test-utils": "^1.0.0-beta.16",
"abcjs": "^5.2.0", "abcjs": "^5.2.0",
"aws-sdk": "^2.133.0", "aws-sdk": "^2.317.0",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"bezier-easing": "^1.1.0", "bezier-easing": "^1.1.0",
"body-parser": "^1.18.2", "body-parser": "^1.18.2",
@ -38,7 +38,7 @@
"handlebars": "^4.0.10", "handlebars": "^4.0.10",
"indexeddbshim": "^3.6.2", "indexeddbshim": "^3.6.2",
"js-yaml": "^3.11.0", "js-yaml": "^3.11.0",
"katex": "^v0.10.0-alpha", "katex": "^v0.10.0-rc.1",
"markdown-it": "^8.4.1", "markdown-it": "^8.4.1",
"markdown-it-abbr": "^1.0.4", "markdown-it-abbr": "^1.0.4",
"markdown-it-deflist": "^2.0.2", "markdown-it-deflist": "^2.0.2",
@ -49,7 +49,7 @@
"markdown-it-pandoc-renderer": "1.1.3", "markdown-it-pandoc-renderer": "1.1.3",
"markdown-it-sub": "^1.0.0", "markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0", "markdown-it-sup": "^1.0.0",
"mermaid": "^7.1.0", "mermaid": "^8.0.0-rc.8",
"mousetrap": "^1.6.1", "mousetrap": "^1.6.1",
"normalize-scss": "^7.0.1", "normalize-scss": "^7.0.1",
"prismjs": "^1.6.0", "prismjs": "^1.6.0",
@ -67,10 +67,10 @@
"babel-jest": "^21.0.2", "babel-jest": "^21.0.2",
"babel-loader": "^7.1.4", "babel-loader": "^7.1.4",
"babel-plugin-dynamic-import-node": "^1.2.0", "babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0", "babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.3.2", "babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.22.0", "babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0", "babel-register": "^6.22.0",
"chalk": "^1.1.3", "chalk": "^1.1.3",

View File

@ -1,10 +1,9 @@
import mermaidUtils from 'mermaid/src/utils'; import mermaidUtils from 'mermaid/src/utils';
import flowRenderer from 'mermaid/src/diagrams/flowchart/flowRenderer'; import flowRenderer from 'mermaid/src/diagrams/flowchart/flowRenderer';
import seq from 'mermaid/src/diagrams/sequenceDiagram/sequenceRenderer'; import sequenceRenderer from 'mermaid/src/diagrams/sequence/sequenceRenderer';
import info from 'mermaid/src/diagrams/example/exampleRenderer'; import ganttRenderer from 'mermaid/src/diagrams/gantt/ganttRenderer';
import gantt from 'mermaid/src/diagrams/gantt/ganttRenderer'; import classRenderer from 'mermaid/src/diagrams/class/classRenderer';
import classRenderer from 'mermaid/src/diagrams/classDiagram/classRenderer'; import gitGraphRenderer from 'mermaid/src/diagrams/git/gitGraphRenderer';
import gitGraphRenderer from 'mermaid/src/diagrams/gitGraph/gitGraphRenderer';
import extensionSvc from '../services/extensionSvc'; import extensionSvc from '../services/extensionSvc';
import utils from '../services/utils'; import utils from '../services/utils';
@ -14,9 +13,9 @@ const config = {
arrowMarkerAbsolute: false, arrowMarkerAbsolute: false,
flowchart: { flowchart: {
htmlLabels: true, htmlLabels: true,
useMaxWidth: true, curve: 'linear',
}, },
sequenceDiagram: { sequence: {
diagramMarginX: 50, diagramMarginX: 50,
diagramMarginY: 10, diagramMarginY: 10,
actorMargin: 50, actorMargin: 50,
@ -39,23 +38,11 @@ const config = {
gridLineStartPadding: 35, gridLineStartPadding: 35,
fontSize: 11, fontSize: 11,
fontFamily: '"Open-Sans", "sans-serif"', fontFamily: '"Open-Sans", "sans-serif"',
numberSectionStyles: 3, numberSectionStyles: 4,
axisFormatter: [ axisFormat: '%Y-%m-%d',
// Within a day
['%I:%M', d => d.getHours()],
// Monday a week
['w. %U', d => d.getDay() === 1],
// Day within a week (not monday)
['%a %d', d => d.getDay() && d.getDate() !== 1],
// within a month
['%b %d', d => d.getDate() !== 1],
// Month
['%m-%y', d => d.getMonth()],
],
}, },
classDiagram: {}, class: {},
gitGraph: {}, git: {},
info: {},
}; };
const containerElt = document.createElement('div'); const containerElt = document.createElement('div');
@ -70,41 +57,33 @@ const render = (elt) => {
try { try {
const graphType = mermaidUtils.detectType(txt); const graphType = mermaidUtils.detectType(txt);
switch (graphType) { switch (graphType) {
case 'gitGraph': case 'git':
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
gitGraphRenderer.setConf(config.gitGraph); gitGraphRenderer.setConf(config.git);
gitGraphRenderer.draw(txt, svgId, false); gitGraphRenderer.draw(txt, svgId, false);
break; break;
case 'graph': case 'flowchart':
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
flowRenderer.setConf(config.flowchart); flowRenderer.setConf(config.flowchart);
flowRenderer.draw(txt, svgId, false); flowRenderer.draw(txt, svgId, false);
break; break;
case 'dotGraph': case 'sequence':
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.sequence.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
flowRenderer.setConf(config.flowchart); sequenceRenderer.setConf(config.sequence);
flowRenderer.draw(txt, svgId, true); sequenceRenderer.draw(txt, svgId);
break;
case 'sequenceDiagram':
config.sequenceDiagram.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
seq.setConf(config.sequenceDiagram);
seq.draw(txt, svgId);
break; break;
case 'gantt': case 'gantt':
config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
gantt.setConf(config.gantt); ganttRenderer.setConf(config.gantt);
gantt.draw(txt, svgId); ganttRenderer.draw(txt, svgId);
break; break;
case 'classDiagram': case 'class':
config.classDiagram.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
classRenderer.setConf(config.classDiagram); classRenderer.setConf(config.class);
classRenderer.draw(txt, svgId); classRenderer.draw(txt, svgId);
break; break;
case 'info':
default: default:
config.info.arrowMarkerAbsolute = config.arrowMarkerAbsolute; throw new Error('Invalid graph type.');
info.draw(txt, svgId, 'Unknown');
break;
} }
elt.parentNode.replaceChild(containerElt.firstChild, elt); elt.parentNode.replaceChild(containerElt.firstChild, elt);
} catch (e) { } catch (e) {

File diff suppressed because it is too large Load Diff