1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibMarkdown: Add support for Tables

This adds support for GFM-like tables.
The HTML rendering ignores the alignments and relative sizes, but the
terminal view does not!
This commit is contained in:
AnotherTest 2020-09-20 16:44:03 +04:30 committed by Andreas Kling
parent 7640cb8ec4
commit 176a2f193c
4 changed files with 309 additions and 1 deletions

View file

@ -30,6 +30,7 @@
#include <LibMarkdown/Heading.h>
#include <LibMarkdown/List.h>
#include <LibMarkdown/Paragraph.h>
#include <LibMarkdown/Table.h>
namespace Markdown {
@ -90,7 +91,8 @@ OwnPtr<Document> Document::parse(const StringView& str)
continue;
}
bool any = helper<List>(lines, blocks) || helper<Paragraph>(lines, blocks) || helper<CodeBlock>(lines, blocks) || helper<Heading>(lines, blocks);
bool any = helper<Table>(lines, blocks) || helper<List>(lines, blocks) || helper<Paragraph>(lines, blocks)
|| helper<CodeBlock>(lines, blocks) || helper<Heading>(lines, blocks);
if (!any)
return nullptr;