Fix extra line feeds in link title (#826)

* Fix extra line feeds in link title

* Test added.
This commit is contained in:
snnz
2024-11-24 13:51:56 +03:00
committed by GitHub
parent 310a55c724
commit 49cf59b819
2 changed files with 10 additions and 0 deletions

View File

@@ -81,6 +81,14 @@ public class TestLinkHelper
Assert.AreEqual(' ', text.CurrentChar);
}
[Test]
public void TestTitleMultiline()
{
var text = new StringSlice("'this\ris\r\na\ntitle'");
Assert.True(LinkHelper.TryParseTitle(ref text, out string title, out _));
Assert.AreEqual("this\ris\r\na\ntitle", title);
}
[Test]
public void TestUrlAndTitle()
{

View File

@@ -567,6 +567,7 @@ public static class LinkHelper
if (c == '\r' && text.PeekChar() == '\n')
{
buffer.Append('\n');
text.SkipChar();
}
continue;
}
@@ -663,6 +664,7 @@ public static class LinkHelper
if (c == '\r' && text.PeekChar() == '\n')
{
buffer.Append('\n');
text.SkipChar();
}
continue;
}