Closed Kazbek closed 4 months ago
Instead of modifying the parser/renderer, the easiest way to do something like this is likely to post-process the syntax tree before you render it
MarkdownPipeline pipeline = new MarkdownPipelineBuilder()
.UseMathematics()
.Build();
string markdown = "$e=mc^2$";
MarkdownDocument document = Markdown.Parse(markdown, pipeline);
foreach (MathInline math in document.Descendants<MathInline>())
{
math.Content = new StringSlice(math.Content.ToString().Replace("e", "42"));
}
string html = document.ToHtml(pipeline);
// <p><span class="math">\(42=mc^2\)</span></p>
@MihaZupan it works good but escaping string that I put in content. So instead
<span class="katex">
I have:
<span class="katex">
Can I somehow write just this part unescaped?
Made my own UseMathematics with custom renderer solved this problem.
Im using math like this e=mc^2 and not it output to
and want to customize output Latex formula. Not just place it "as is" but process with my string to string function
so output will be:
Can I somehow configure Math processor? I guess it must affect in this two places: one and two