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

Markdown.ToHtml throws InvalidOperationException "A block is already being replaced" #841

Closed
mschessler opened this issue Jan 2, 2025 · 0 comments · Fixed by #842
Closed

Comments

@mschessler
Copy link

mschessler commented Jan 2, 2025

Tested Version: newest commit d1233ff on main

grafik

grafik

Reproducer:

var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
var result = Markdown.ToHtml(">[!kk]\r\n[!kk]", pipeline);

Stacktrace:

at Markdig.Parsers.InlineProcessor.ReplaceParentContainer(ContainerBlock previousParentContainer, ContainerBlock newParentContainer) in \src\Markdig\Parsers\InlineProcessor.cs:line 219
at Markdig.Extensions.Alerts.AlertInlineParser.Match(InlineProcessor processor, StringSlice& slice) in \src\Markdig\Extensions\Alerts\AlertInlineParser.cs:line 123
at Markdig.Parsers.InlineProcessor.ProcessInlineLeaf(LeafBlock leafBlock) in \src\Markdig\Parsers\InlineProcessor.cs:line 273
at Markdig.Parsers.MarkdownParser.ProcessInlines(InlineProcessor inlineProcessor, MarkdownDocument document) in \src\Markdig\Parsers\MarkdownParser.cs:line 172
at Markdig.Parsers.MarkdownParser.Parse(String text, MarkdownPipeline pipeline, MarkdownParserContext context) in \src\Markdig\Parsers\MarkdownParser.cs:line 75
at Markdig.Markdown.ToHtml(String markdown, MarkdownPipeline pipeline, MarkdownParserContext context) in \src\Markdig\Markdown.cs:line 101
at FuzzTest.Program.Main(String[] args) in \FuzzingTargets\MarkdigFuzzer\Program.cs:line 13

Credit: Found with Sharpfuzz

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