[PR #588] [CLOSED] Diagrams are not correctly escaped #1124

Open
opened 2026-01-29 14:50:03 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/xoofx/markdig/pull/588
Author: @tibel
Created: 1/20/2022
Status: Closed

Base: masterHead: bugfix/diagrams-escaping


📝 Commits (1)

  • 11df002 don't use softEscape with BlocksAsDiv

📊 Changes

3 files changed (+13 additions, -13 deletions)

View changed files

📝 src/Markdig.Tests/Specs/DiagramsSpecs.generated.cs (+7 -7)
📝 src/Markdig.Tests/Specs/DiagramsSpecs.md (+5 -5)
📝 src/Markdig/Renderers/Html/CodeBlockRenderer.cs (+1 -1)

📄 Description

The issue with diagrams extension is that not all characters are escaped and thus invalid HTML could be generated.
A diagram sample is https://www.nomnoml.com/ that contains <table> in the diagram text.
Currently markdig is not escaping > but is escaping <.
This results in parsing errors in mermaid and nomnoml.

CodeBlockRenderer uses softEsacape=false and with BlocksAsDiv it uses softEscape=true.
According to documentation BlocksAsDiv should not change escaping behavior.

Please let me know when there are questions or something is missing.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/xoofx/markdig/pull/588 **Author:** [@tibel](https://github.com/tibel) **Created:** 1/20/2022 **Status:** ❌ Closed **Base:** `master` ← **Head:** `bugfix/diagrams-escaping` --- ### 📝 Commits (1) - [`11df002`](https://github.com/xoofx/markdig/commit/11df002666a033c95572407fe835147cba599218) don't use softEscape with BlocksAsDiv ### 📊 Changes **3 files changed** (+13 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/Markdig.Tests/Specs/DiagramsSpecs.generated.cs` (+7 -7) 📝 `src/Markdig.Tests/Specs/DiagramsSpecs.md` (+5 -5) 📝 `src/Markdig/Renderers/Html/CodeBlockRenderer.cs` (+1 -1) </details> ### 📄 Description The issue with diagrams extension is that not all characters are escaped and thus invalid HTML could be generated. A diagram sample is https://www.nomnoml.com/ that contains `<table>` in the diagram text. Currently markdig is not escaping `>` but is escaping `<`. This results in parsing errors in mermaid and nomnoml. `CodeBlockRenderer` uses `softEsacape=false` and with `BlocksAsDiv` it uses `softEscape=true`. According to documentation `BlocksAsDiv` should not change escaping behavior. Please let me know when there are questions or something is missing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 14:50:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1124