mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:47:45 +00:00
LibMarkdown: Implement introspection of the document tree
This commit is contained in:
parent
aca01932bd
commit
24e7196158
23 changed files with 319 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <LibMarkdown/Document.h>
|
||||
#include <LibMarkdown/LineIterator.h>
|
||||
#include <LibMarkdown/Visitor.h>
|
||||
|
||||
namespace Markdown {
|
||||
|
||||
|
@ -41,6 +42,15 @@ String Document::render_for_terminal(size_t view_width) const
|
|||
return m_container->render_for_terminal(view_width);
|
||||
}
|
||||
|
||||
RecursionDecision Document::walk(Visitor& visitor) const
|
||||
{
|
||||
RecursionDecision rd = visitor.visit(*this);
|
||||
if (rd != RecursionDecision::Recurse)
|
||||
return rd;
|
||||
|
||||
return m_container->walk(visitor);
|
||||
}
|
||||
|
||||
OwnPtr<Document> Document::parse(const StringView& str)
|
||||
{
|
||||
const Vector<StringView> lines_vec = str.lines();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue