#1252 Adding confuration options and some cleanup, swicth of graphType from git to gitGraph

This commit is contained in:
Knut Sveidqvist
2022-04-07 18:22:06 +02:00
parent 57ac111d05
commit 87b56bdd9a
11 changed files with 254 additions and 444 deletions

View File

@@ -72,14 +72,14 @@ function parse(text) {
const graphInit = utils.detectInit(text, cnf);
if (graphInit) {
reinitialize(graphInit);
log.debug('reinit ', graphInit);
log.info('reinit ', graphInit);
}
const graphType = utils.detectType(text, cnf);
let parser;
log.debug('Type ' + graphType);
switch (graphType) {
case 'git':
case 'gitGraph':
parser = gitGraphParser;
parser.parser.yy = gitGraphAst;
break;
@@ -229,6 +229,9 @@ const render = function (id, _txt, cb, container) {
configApi.addDirective(graphInit);
}
let cnf = configApi.getConfig();
log.debug(cnf);
// Check the maximum allowed text size
if (_txt.length > cnf.maxTextSize) {
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
@@ -422,7 +425,7 @@ const render = function (id, _txt, cb, container) {
try {
switch (graphType) {
case 'git':
case 'gitGraph':
// cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
//gitGraphRenderer.setConf(cnf.git);
gitGraphRenderer.draw(txt, id, false);