From 3168084cf5987384c9adcd3d96a4f49d1b15c831 Mon Sep 17 00:00:00 2001 From: Austin Fulbright Date: Sat, 27 Jul 2024 00:03:59 -0400 Subject: [PATCH] fixed rendering --- packages/mermaid/src/diagrams/git/gitGraphAst.ts | 2 +- packages/mermaid/src/diagrams/git/gitGraphParser.ts | 7 +++++-- packages/parser/src/language/gitGraph/gitGraph.langium | 4 ---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/mermaid/src/diagrams/git/gitGraphAst.ts b/packages/mermaid/src/diagrams/git/gitGraphAst.ts index b0a5ffd317..23cd20d805 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphAst.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphAst.ts @@ -35,7 +35,7 @@ const state = new ImperativeState(() => ({ branchConfig: new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]), branches: new Map([[mainBranchName, null]]), currBranch: mainBranchName, - direction: 'TB', + direction: 'LR', seq: 0, options: {}, })); diff --git a/packages/mermaid/src/diagrams/git/gitGraphParser.ts b/packages/mermaid/src/diagrams/git/gitGraphParser.ts index 8116d7d4cd..b657b94b83 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphParser.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphParser.ts @@ -15,6 +15,11 @@ import type { const populate = (ast: GitGraph) => { populateCommonDb(ast, db); + // @ts-ignore: this wont exist if the direction is not specified + if (ast.dir) { + // @ts-ignore: this wont exist if the direction is not specified + db.setDirection(ast.dir); + } for (const statement of ast.statements) { parseStatement(statement); } @@ -46,9 +51,7 @@ const parseCommit = (commit: CommitAst) => { const id = commit.id; const message = commit.message ?? ''; const tags = commit.tags ?? undefined; - log.info(`Commit type`, commit.type); const type = commit.type !== undefined ? commitType[commit.type] : 0; - log.info(`Commit: ${id} ${message} ${type}`); db.commit(message, id, type, tags); }; diff --git a/packages/parser/src/language/gitGraph/gitGraph.langium b/packages/parser/src/language/gitGraph/gitGraph.langium index 9c97e6e84a..176e6ee7ef 100644 --- a/packages/parser/src/language/gitGraph/gitGraph.langium +++ b/packages/parser/src/language/gitGraph/gitGraph.langium @@ -29,7 +29,6 @@ entry GitGraph: 'gitGraph' Direction? ':'? NEWLINE* ( - Options? NEWLINE* (TitleAndAccessibilities | statements+=Statement | @@ -48,9 +47,6 @@ Statement Direction: dir=('LR' | 'TB' | 'BT'); -Options: - 'options' '{' rawOptions+=STRING* '}' EOL; - Commit: 'commit' (