mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibMarkdown: Add LineIterator
LineIterator wraps a vector's ConstIterator, to provide an iterator that can work on indented container blocks (like lists and blockquotes).
This commit is contained in:
parent
cd560d3ae3
commit
10f6f6a723
Notes:
sideshowbarker
2024-07-18 03:02:28 +09:00
Author: https://github.com/petelliott
Commit: 10f6f6a723
Pull-request: https://github.com/SerenityOS/serenity/pull/10271
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/kleinesfilmroellchen
16 changed files with 139 additions and 21 deletions
|
@ -6,13 +6,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibMarkdown/CodeBlock.h>
|
||||
#include <LibMarkdown/Document.h>
|
||||
#include <LibMarkdown/Heading.h>
|
||||
#include <LibMarkdown/HorizontalRule.h>
|
||||
#include <LibMarkdown/List.h>
|
||||
#include <LibMarkdown/Paragraph.h>
|
||||
#include <LibMarkdown/Table.h>
|
||||
#include <LibMarkdown/LineIterator.h>
|
||||
|
||||
namespace Markdown {
|
||||
|
||||
|
@ -49,7 +44,7 @@ String Document::render_for_terminal(size_t view_width) const
|
|||
OwnPtr<Document> Document::parse(const StringView& str)
|
||||
{
|
||||
const Vector<StringView> lines_vec = str.lines();
|
||||
auto lines = lines_vec.begin();
|
||||
LineIterator lines(lines_vec.begin());
|
||||
return make<Document>(ContainerBlock::parse(lines));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue