From 2716e2f626c2b5e73dd3dd20ddf1c7f4b5cd2236 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 8 Oct 2023 15:32:42 +0200 Subject: [PATCH] Fix mermaid flowchart margin issue (#27503) (#27517) Backport https://github.com/go-gitea/gitea/pull/27503 to 1.20 Fixes: https://github.com/go-gitea/gitea/issues/27435 Related: https://github.com/mermaid-js/mermaid/issues/4907 image (cherry picked from commit 1d4c193df588c0141fad456f1c17b8dfaf733265) --- web_src/js/markup/mermaid.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web_src/js/markup/mermaid.js b/web_src/js/markup/mermaid.js index 865a414c93..84d88a94c3 100644 --- a/web_src/js/markup/mermaid.js +++ b/web_src/js/markup/mermaid.js @@ -4,9 +4,11 @@ import {displayError} from './common.js'; const {mermaidMaxSourceCharacters} = window.config; +// margin removal is for https://github.com/mermaid-js/mermaid/issues/4907 const iframeCss = `:root {color-scheme: normal} body {margin: 0; padding: 0; overflow: hidden} -#mermaid {display: block; margin: 0 auto}`; +#mermaid {display: block; margin: 0 auto} +blockquote, dd, dl, figure, h1, h2, h3, h4, h5, h6, hr, p, pre {margin: 0}`; export async function renderMermaid() { const els = document.querySelectorAll('.markup code.language-mermaid');