1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

LibMarkdown: Rewrite Inline text parser to be more forgiving

The previous Text::parse was not able to give up on parsing a textual
element, and just leave it as plain text. Because this is a very
important part of markdown, I fully rewrote the parser to support this
without having to backtrack. Also the parser now some other little
features, such ast delimiter runs and flanking.
This commit is contained in:
Peter Elliott 2021-09-06 19:11:46 -06:00 committed by Andreas Kling
parent 80e58dab9a
commit ec9f892899
10 changed files with 462 additions and 397 deletions

View file

@ -53,10 +53,7 @@ OwnPtr<Heading> Heading::parse(Vector<StringView>::ConstIterator& lines)
StringView title_view = line.substring_view(level + 1, line.length() - level - 1);
auto text = Text::parse(title_view);
if (!text.has_value())
return {};
auto heading = make<Heading>(move(text.value()), level);
auto heading = make<Heading>(move(text), level);
++lines;
return heading;