mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-04 05:44:50 +00:00
Markdown.ToPlainText() returns HTML tags for mathematics #479
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Sleepyowl on GitHub (Aug 12, 2021).
Invalid conversion to plain text for mathematic blocks:
Repro:
expected result: no HTML tags
actual result:
<span class="math">\(x_{1}=\frac{-b + \sqrt{b^{2} - 4ac}}{2a}\)</span>@xoofx commented on GitHub (Aug 22, 2021):
Plain text does not support many extensions. You will need to create a PR to fix it.
@Sleepyowl commented on GitHub (Aug 24, 2021):
Makes sense.
Giving this a second thought, simply removing html tags and outputting source LaTeX is not “Plain Text” enough for my purposes.
If you’re OK with dragging in LaTeX parser dependency, I’ll create a PR when (or to be honest, more like “if”) I get it done.
@xoofx commented on GitHub (Aug 24, 2021):
Unfortunately, Markdig has a policy to not take any dependencies. As Markdig can embed any kind of non-markdown content (HTML, custom content like LaTex...etc.), it is not practical to support these scenarios (that can be very app/end-user specific and difficult to fit-for-all)
Though, the markdig API should provide enough pluggability to develop what you are looking for as an extension, outside of the Markdig lib/repo.
@Sleepyowl commented on GitHub (Aug 24, 2021):
Ok I went with a simple approach for the PR: I've added checks for EnableHtml* flags to the extension.
I cannot figure out though how to link the PR to this issue, but here it is: https://github.com/xoofx/markdig/pull/570