Commit ea9ee18c authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'mermaid-js-fix' into 'master'

Don't render mermaid diagrams in search result

Closes #35962

See merge request gitlab-org/gitlab!23033
parents 84189487 69025cdc
...@@ -21,6 +21,9 @@ const MAX_CHAR_LIMIT = 5000; ...@@ -21,6 +21,9 @@ const MAX_CHAR_LIMIT = 5000;
export default function renderMermaid($els) { export default function renderMermaid($els) {
if (!$els.length) return; if (!$els.length) return;
// A diagram may have been truncated in search results which will cause errors, so abort the render.
if (document.querySelector('body').dataset.page === 'search:show') return;
import(/* webpackChunkName: 'mermaid' */ 'mermaid') import(/* webpackChunkName: 'mermaid' */ 'mermaid')
.then(mermaid => { .then(mermaid => {
mermaid.initialize({ mermaid.initialize({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment