Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-27 20:26:09 +01:00

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

<img width="924" alt="image"

src="https://github.com/go-gitea/gitea/assets/115237/494a1d2e-4c56-48d0-9843-82a5e5aa977e">

(cherry picked from commit 1d4c193df5)
This commit is contained in:
silverwind 2023-10-08 15:32:42 +02:00 committed by Earl Warren
parent e0fe8a8ab4
commit 2716e2f626
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -4,9 +4,11 @@ import {displayError} from './common.js';
const {mermaidMaxSourceCharacters} = window.config; const {mermaidMaxSourceCharacters} = window.config;
// margin removal is for https://github.com/mermaid-js/mermaid/issues/4907
const iframeCss = `:root {color-scheme: normal} const iframeCss = `:root {color-scheme: normal}
body {margin: 0; padding: 0; overflow: hidden} 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() { export async function renderMermaid() {
const els = document.querySelectorAll('.markup code.language-mermaid'); const els = document.querySelectorAll('.markup code.language-mermaid');