diff --git a/src/common/gitProvider/utilsMarkdown.ts b/src/common/gitProvider/utilsMarkdown.ts index b1aa3e99f..1fb36a712 100644 --- a/src/common/gitProvider/utilsMarkdown.ts +++ b/src/common/gitProvider/utilsMarkdown.ts @@ -88,10 +88,10 @@ export async function flowDiffToMarkdownForPullRequest(flowNames: string[], from const fileMetadata = await MetadataUtils.findMetaFileFromTypeAndName("Flow", flowName); try { if (supportsMermaidInPrMarkdown) { - await generateMarkdownWithMermaid(fileMetadata, fromCommit, toCommit, flowDiffMarkdownList, flowName); + await generateDiffMarkdownWithMermaid(fileMetadata, fromCommit, toCommit, flowDiffMarkdownList, flowName); } else { - await generateMarkdownWithSvg(fileMetadata, fromCommit, toCommit, flowDiffMarkdownList, flowName); + await generateDiffMarkdownWithSvg(fileMetadata, fromCommit, toCommit, flowDiffMarkdownList, flowName); } } catch (e: any) { uxLog(this, c.yellow(`[FlowGitDiff] Unable to generate Flow diff: ${e.message}`)); @@ -108,7 +108,7 @@ Error while generating Flows visual git diff } } -async function generateMarkdownWithMermaid(fileMetadata: string | null, fromCommit: string, toCommit: string, flowDiffMarkdownList: any, flowName: string) { +async function generateDiffMarkdownWithMermaid(fileMetadata: string | null, fromCommit: string, toCommit: string, flowDiffMarkdownList: any, flowName: string) { const { outputDiffMdFile } = await generateFlowVisualGitDiff(fileMetadata, fromCommit, toCommit, { mermaidMd: true, svgMd: false, debug: false }); if (outputDiffMdFile) { const flowDiffMarkdownMermaid = await fs.readFile(outputDiffMdFile.replace(".md", ".mermaid.md"), "utf8"); @@ -116,7 +116,7 @@ async function generateMarkdownWithMermaid(fileMetadata: string | null, fromComm } } -async function generateMarkdownWithSvg(fileMetadata: string | null, fromCommit: string, toCommit: string, flowDiffMarkdownList: any, flowName: string) { +async function generateDiffMarkdownWithSvg(fileMetadata: string | null, fromCommit: string, toCommit: string, flowDiffMarkdownList: any, flowName: string) { const { outputDiffMdFile } = await generateFlowVisualGitDiff(fileMetadata, fromCommit, toCommit, { mermaidMd: true, svgMd: true, debug: false }); flowDiffMarkdownList.push({ name: flowName, markdown: outputDiffMdFile }); } diff --git a/src/common/utils/mermaidUtils.ts b/src/common/utils/mermaidUtils.ts index fd9c9dfef..cc9c1ffd7 100644 --- a/src/common/utils/mermaidUtils.ts +++ b/src/common/utils/mermaidUtils.ts @@ -359,10 +359,10 @@ function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, // Tables lines if (!isMermaid && status === "removed" && styledLine.startsWith("|") && !styledLine.startsWith("|:-")) { - styledLine = "|🟥" + styledLine.split("|").filter(e => e !== "").map((col: string) => `${col}`).join("|") + "|"; + styledLine = "|🟥" + styledLine.split("|").filter(e => e !== "").map((col: string) => `${col}`).join("|") + "|"; } else if (!isMermaid && status === "added" && styledLine.startsWith("|") && !styledLine.startsWith("|:-")) { - styledLine = "|🟩" + styledLine.split("|").filter(e => e !== "").map((col: string) => `${col}`).join("|") + "|"; + styledLine = "|🟩" + styledLine.split("|").filter(e => e !== "").map((col: string) => `${col}`).join("|") + "|"; } // Normal lines header 3 else if (!isMermaid && status === "removed" && styledLine.startsWith("#### ")) { @@ -387,10 +387,10 @@ function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, } // Normal lines else if (!isMermaid && status === "removed" && styledLine !== "" && !styledLine.startsWith("|:-") && !styledLine.startsWith("___")) { - styledLine = `🟥${styledLine}`; + styledLine = `🟥${styledLine}`; } else if (!isMermaid && status === "added" && styledLine !== "" && !styledLine.startsWith("|:-") && !styledLine.startsWith("___")) { - styledLine = `🟩${styledLine}`; + styledLine = `🟩${styledLine}`; } // Boxes lines else if (isMermaid === true && status === "removed" && currentLine.split(":::").length === 2) {