mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
[PR #58] [MERGED] Fixes issue when using colon (among others) on lines with abbreviations #798
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?
📋 Pull Request Information
Original PR: https://github.com/xoofx/markdig/pull/58
Author: @christophano
Created: 9/15/2016
Status: ✅ Merged
Merged: 9/18/2016
Merged by: @xoofx
Base:
master← Head:bugfix/abbreviation-existing-container📝 Commits (1)
1b92311Fixes issue when using colon (among others) on lines with abbreviations📊 Changes
2 files changed (+16 additions, -8 deletions)
View changed files
📝
src/Markdig/Extensions/Abbreviations/AbbreviationParser.cs(+11 -7)📝
src/Markdig/Parsers/InlineProcessor.cs(+5 -1)📄 Description
I discovered a very strange issue when using abbreviations inline after a potential delimiter (in my case, a colon).
The code would throw an
ArgumentExceptionfrom line 54 ofContainerInline.cs.Example:
This is due to the processor storing the first part of the content in a
LiteralInlinewhile it tries to validate the character as a valid delimiter. When this fails it returns and continues with the rest of the inline, including the first section. This means that when theAbbreviationParserfinds a valid abbreviation during the post match, theLiteralInlinealready has a parent, which throws the exception.The solution involves using the existing
LiteralInlineparent as the container (if it exists) instead of creating a newContainerInlineand checking that the parent is null before the call toContainerInline.AppendChild.There is also a check in
InlineProcessor, when adding an inline without a parent as a child of the last container that this is not already the last container. This would mean at some point the parent is not being assigned when it ought to have been (I haven't found this yet though), but the check is poss🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.