Skip to content

Commit

Permalink
parser: Workaround a crash on an incorrect url span in
Browse files Browse the repository at this point in the history
The sample text is: `[][][]`
The url span returned is -1 -- 0 which is bogus.
  • Loading branch information
artempyanykh committed Oct 6, 2024
1 parent 2973cec commit 830f488
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Marksman/Parser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ module Markdown =
let link = MdLink.RC label |> Node.mk linkText linkRange
elements.Add(ML link)
// The last remaining option is full reference
else
//
// NOTE: there's something off in Markdig's LinkHelper.TryParseLabelTrivia
// This is called from PatchedInlineLinkParser:341.
// TODO: Figure out why there's an incorrect urlSpan (-1 -- 0) returned.
else if not (String.IsNullOrEmpty url) then
let text_ = Node.mkText label (sourceSpanToRange text labelSpan)
let label = Node.mkText url (sourceSpanToRange text urlSpan)
let link = MdLink.RF(text_, label) |> Node.mk linkText linkRange
Expand Down

0 comments on commit 830f488

Please sign in to comment.