Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mermaid code blocks in markdown showing error #21427

Closed
dvjn opened this issue Oct 12, 2022 · 1 comment · Fixed by #21431
Closed

Mermaid code blocks in markdown showing error #21427

dvjn opened this issue Oct 12, 2022 · 1 comment · Fixed by #21431
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there

Comments

@dvjn
Copy link

dvjn commented Oct 12, 2022

Description

When I create a mermaid code block in a markdown file, error banners are shown on each character input.
Also, in the preview tab, the height of the mermaid diagram is broken.

This is working properly on v1.17 but breaking on dev.

Stacktrace:

22:32:03.497 Uncaught Error: Language id "vs.editor.nullLanguage" is not configured nor known

F@https://try.gitea.io/assets/js/monaco.943e8892.js:135:7465
getLanguageConfiguration@https://try.gitea.io/assets/js/monaco.943e8892.js:135:7221
getLanguageConfiguration@https://try.gitea.io/assets/js/monaco.943e8892.js:154:21355
getWordAtPosition@https://try.gitea.io/assets/js/monaco.943e8892.js:154:21664
getWordAtPosition@https://try.gitea.io/assets/js/monaco.943e8892.js:163:10576
Ue@https://try.gitea.io/assets/js/monaco.943e8892.js:251:5156
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/rt/<@https://try.gitea.io/assets/js/monaco.943e8892.js:251:3900
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/X/<@https://try.gitea.io/assets/js/monaco.943e8892.js:250:6704
X@https://try.gitea.io/assets/js/monaco.943e8892.js:250:6467
rt@https://try.gitea.io/assets/js/monaco.943e8892.js:251:3856
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/update/</Kt</<@https://try.gitea.io/assets/js/monaco.943e8892.js:251:525
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/X/<@https://try.gitea.io/assets/js/monaco.943e8892.js:250:6704
X@https://try.gitea.io/assets/js/monaco.943e8892.js:250:6467
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/update/</Kt<@https://try.gitea.io/assets/js/monaco.943e8892.js:251:473
T@https://try.gitea.io/assets/js/monaco.943e8892.js:28:79091
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/update/<@https://try.gitea.io/assets/js/monaco.943e8892.js:251:467
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/X/<@https://try.gitea.io/assets/js/monaco.943e8892.js:250:6704
X@https://try.gitea.io/assets/js/monaco.943e8892.js:250:6467
update@https://try.gitea.io/assets/js/monaco.943e8892.js:251:345
./node_modules/monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostText.contribution.js/ve/this.updateSoon<@https://try.gitea.io/assets/js/monaco.943e8892.js:250:10076
doRun@https://try.gitea.io/assets/js/monaco.943e8892.js:28:83100
onTimeout@https://try.gitea.io/assets/js/monaco.943e8892.js:28:83040
    unexpectedErrorHandler https://try.gitea.io/assets/js/monaco.943e8892.js:30
monaco.943e8892.js:30:12

Gitea Version

dev

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image
image
image

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker Image: gitea/gitea:dev

Database

SQLite

@dvjn dvjn added the type/bug label Oct 12, 2022
@silverwind
Copy link
Member

silverwind commented Oct 12, 2022

Seems this is a bug introduced in Monaco 0.34: microsoft/monaco-editor#2962.

I don't think we can do anything about it until it's fixed upstream, at best, we could filter out this specific error message or downgrade Monaco.

@silverwind silverwind added type/upstream This is an issue in one of Gitea's dependencies and should be reported there issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Oct 12, 2022
silverwind added a commit to silverwind/gitea that referenced this issue Oct 12, 2022
1. Apparently, mermaid 9.1.7 no longer sets a `height` attribute on the
   SVG it produces. Workaround by extracting height from `viewBox`
   instead.
2. Filter out unresolvable Monaco errors from error display.

Fixes: go-gitea#21427
Ref: microsoft/monaco-editor#2962
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug type/upstream This is an issue in one of Gitea's dependencies and should be reported there
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants