Skip to content

Commit 87b56bd

Browse files
committed
mermaid-js#1252 Adding confuration options and some cleanup, swicth of graphType from git to gitGraph
1 parent 57ac111 commit 87b56bd

File tree

11 files changed

+259
-449
lines changed

11 files changed

+259
-449
lines changed

cypress/platform/gitgraph2.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<style>
1010
body {
1111
/* background: rgb(221, 208, 208); */
12-
background:#111;
12+
/* background:#111; */
1313
/* background:#333; */
1414
font-family: 'Arial';
1515
}
@@ -43,6 +43,7 @@ <h1>info below</h1>
4343

4444
</div>
4545
<div class="mermaid" style="width: 100%; height: 20%;">
46+
%%{init: { "gitGraph": { "showBranches": false, "mainBranchName": "APA" }}}%%
4647
gitGraph
4748
commit
4849
branch hotfix
@@ -101,7 +102,7 @@ <h1>info below</h1>
101102
// console.error('Mermaid error: ', err);
102103
};
103104
mermaid.initialize({
104-
theme: 'dark',
105+
theme: 'default',
105106
themeVariables: {
106107
// primaryColor: '#9400D3',
107108
// darkMode: false,
@@ -119,6 +120,7 @@ <h1>info below</h1>
119120
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
120121
logLevel: 1,
121122
flowchart: { curve: 'linear', htmlLabels: true },
123+
// gitGraph: { showCommitLabel: false },
122124
// gantt: { axisFormat: '%m/%d/%Y' },
123125
sequence: { actorMargin: 50, showSequenceNumbers: true },
124126
// sequenceDiagram: { actorMargin: 300 } // deprecated

docs/Setup.md

-13
Original file line numberDiff line numberDiff line change
@@ -756,19 +756,6 @@ available space if not the absolute space required is used.
756756

757757
Default value: true
758758

759-
## useMaxWidth
760-
761-
| Parameter | Description | Type | Required | Values |
762-
| ----------- | ----------- | ------- | -------- | ----------- |
763-
| useMaxWidth | See notes | boolean | 4 | true, false |
764-
765-
**Notes:**
766-
767-
When this flag is set the height and width is set to 100% and is then scaling with the
768-
available space if not the absolute space required is used.
769-
770-
Default value: true
771-
772759
## defaultRenderer
773760

774761
| Parameter | Description | Type | Required | Values |

src/Diagram.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Diagram {
4949
this.type = utils.detectType(txt, cnf);
5050
log.debug('Type ' + this.type);
5151
switch (this.type) {
52-
case 'git':
52+
case 'gitGraph':
5353
this.parser = gitGraphParser;
5454
this.parser.parser.yy = gitGraphAst;
5555
this.db = gitGraphAst;

src/config_org.js

-162
This file was deleted.

src/defaultConfig.js

+4-30
Original file line numberDiff line numberDiff line change
@@ -844,25 +844,6 @@ const config = {
844844
*/
845845
defaultRenderer: 'dagre-wrapper',
846846
},
847-
git: {
848-
arrowMarkerAbsolute: false,
849-
850-
useWidth: undefined,
851-
852-
/**
853-
* | Parameter | Description | Type | Required | Values |
854-
* | ----------- | ----------- | ------- | -------- | ----------- |
855-
* | useMaxWidth | See notes | boolean | 4 | true, false |
856-
*
857-
* **Notes:**
858-
*
859-
* When this flag is set the height and width is set to 100% and is then scaling with the
860-
* available space if not the absolute space required is used.
861-
*
862-
* Default value: true
863-
*/
864-
useMaxWidth: true,
865-
},
866847
state: {
867848
dividerMargin: 10,
868849
sizeUnit: 5,
@@ -1066,27 +1047,20 @@ const config = {
10661047
},
10671048
gitGraph: {
10681049
diagramPadding: 8,
1069-
nodeSpacing: 150,
1070-
nodeFillColor: 'yellow',
1071-
nodeStrokeWidth: 2,
1072-
nodeStrokeColor: 'grey',
1073-
lineStrokeWidth: 4,
1074-
branchOffset: 50,
1075-
lineColor: 'grey',
1076-
leftMargin: 50,
1077-
branchColors: ['#442f74', '#983351', '#609732', '#AA9A39'],
1078-
nodeRadius: 10,
10791050
nodeLabel: {
10801051
width: 75,
10811052
height: 100,
10821053
x: -25,
10831054
y: 0,
10841055
},
1056+
mainBranchName: 'main',
1057+
showCommitLabel: true,
1058+
showBranches: true,
10851059
},
10861060
};
10871061

10881062
config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
1089-
config.git.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
1063+
config.gitGraph.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
10901064

10911065
const keyify = (obj, prefix = '') =>
10921066
Object.keys(obj).reduce((res, el) => {

src/diagrams/git/gitGraphAst.js

-4
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ export const merge = function (otherBranch) {
220220

221221
export const checkout = function (branch) {
222222
branch = common.sanitizeText(branch, configApi.getConfig());
223-
console.info(branches);
224223
if (typeof branches[branch] === 'undefined') {
225224
let error = new Error(
226225
'Trying to checkout branch which is not yet created. (Help try using "branch ' + branch + '")'
@@ -238,9 +237,6 @@ export const checkout = function (branch) {
238237
} else {
239238
curBranch = branch;
240239
const id = branches[curBranch];
241-
console.log(id);
242-
console.log('hi');
243-
console.log(commits);
244240
head = commits[id];
245241
}
246242
};

0 commit comments

Comments
 (0)