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

More robust Mermaid diagram fixing #2084

Merged
merged 3 commits into from
Oct 23, 2024
Merged

More robust Mermaid diagram fixing #2084

merged 3 commits into from
Oct 23, 2024

Conversation

dividedmind
Copy link
Collaborator

This improves mermaid diagram fixing in the backend by:

  • simplifying the code;
  • implementing a hack to make dompurify work in the backend; this ensures broken diagrams are detected correctly (previously, when diagram validation attempted to call dompurify, the error would cause the validation to end prematurely and make the code ignore the spurious error and assume the diagram was valid even though an error could have been detected later) — while this does not solve @diagram when the diagram has unresolved errors, helpful information should be displayed #2071 entirely it at least makes the user see the broken code as text,
  • show a message to the user when repairing a diagram so it doesn't look stuck.

This displays a message to the user on fix attempt and avoids
DOMPurify errors.
@@ -45,6 +45,7 @@
"@langchain/openai": "^0.2.7",
"fast-xml-parser": "^4.4.0",
"js-yaml": "^4.1.0",
"jsdom": "^16.6.0",
"langchain": "^0.2.16",
"mermaid": "^9",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as you're here, can you take a look at upgrading to mermaid 10? I believe that would allow vscode-appland to link to a local appmap-js repo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually did try, but mermaid 10 is ESM-only.

@dustinbyrne dustinbyrne merged commit 542a276 into main Oct 23, 2024
21 of 23 checks passed
@dustinbyrne dustinbyrne deleted the fix/mermaid-fixer branch October 23, 2024 17:43
@appland-release
Copy link
Contributor

🎉 This PR is included in version @appland/navie-v1.34.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants