mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-04 05:44:50 +00:00
Fix #872 by reserve null title string.
This commit is contained in:
@@ -465,6 +465,24 @@ public static class HtmlHelper
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructively unescape a string: remove backslashes before punctuation or symbol characters.
|
||||
/// </summary>
|
||||
/// <param name="text">The string data that will be changed by unescaping any punctuation or symbol characters.</param>
|
||||
/// <param name="removeBackSlash">if set to <c>true</c> [remove back slash].</param>
|
||||
/// <returns>Unescaped text, or null if <paramref name="text"/> is null.<returns>
|
||||
public static string? UnescapeNullable(string? text, bool removeBackSlash = true)
|
||||
{
|
||||
if (text == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Unescape(text, removeBackSlash);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructively unescape a string: remove backslashes before punctuation or symbol characters.
|
||||
/// </summary>
|
||||
|
||||
@@ -411,7 +411,7 @@ public static class LinkHelper
|
||||
{
|
||||
// Skip ')'
|
||||
text.SkipChar();
|
||||
title ??= string.Empty;
|
||||
// not to normalize nulls
|
||||
}
|
||||
|
||||
return isValid;
|
||||
|
||||
@@ -260,7 +260,7 @@ public class LinkInlineParser : InlineParser
|
||||
link = new LinkInline()
|
||||
{
|
||||
Url = HtmlHelper.Unescape(url, removeBackSlash: false),
|
||||
Title = HtmlHelper.Unescape(title, removeBackSlash: false),
|
||||
Title = HtmlHelper.UnescapeNullable(title, removeBackSlash: false),
|
||||
IsImage = openParent.IsImage,
|
||||
LabelSpan = openParent.LabelSpan,
|
||||
UrlSpan = inlineState.GetSourcePositionFromLocalSpan(linkSpan),
|
||||
|
||||
Reference in New Issue
Block a user