mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +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:
parent
80e58dab9a
commit
ec9f892899
10 changed files with 462 additions and 397 deletions
|
@ -14,9 +14,9 @@ namespace Markdown {
|
|||
|
||||
class CodeBlock final : public Block {
|
||||
public:
|
||||
CodeBlock(Text&& style_spec, const String& code)
|
||||
CodeBlock(const String& language, const String& code)
|
||||
: m_code(move(code))
|
||||
, m_style_spec(move(style_spec))
|
||||
, m_language(language)
|
||||
{
|
||||
}
|
||||
virtual ~CodeBlock() override { }
|
||||
|
@ -26,11 +26,8 @@ public:
|
|||
static OwnPtr<CodeBlock> parse(Vector<StringView>::ConstIterator& lines);
|
||||
|
||||
private:
|
||||
String style_language() const;
|
||||
Text::Style style() const;
|
||||
|
||||
String m_code;
|
||||
Text m_style_spec;
|
||||
String m_language;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue