summaryrefslogtreecommitdiff
path: root/Libraries/LibMarkdown/Paragraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibMarkdown/Paragraph.h')
-rw-r--r--Libraries/LibMarkdown/Paragraph.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/Libraries/LibMarkdown/Paragraph.h b/Libraries/LibMarkdown/Paragraph.h
index d5e63a03c2..98e9dc9b9e 100644
--- a/Libraries/LibMarkdown/Paragraph.h
+++ b/Libraries/LibMarkdown/Paragraph.h
@@ -26,6 +26,7 @@
#pragma once
+#include <AK/NonnullOwnPtrVector.h>
#include <AK/OwnPtr.h>
#include <LibMarkdown/Block.h>
#include <LibMarkdown/Text.h>
@@ -34,18 +35,34 @@ namespace Markdown {
class Paragraph final : public Block {
public:
- explicit Paragraph(Text&& text)
- : m_text(move(text))
+ class Line {
+ public:
+ explicit Line(Text&& text)
+ : m_text(move(text))
+ {
+ }
+
+ static OwnPtr<Line> parse(Vector<StringView>::ConstIterator& lines);
+ const Text& text() const { return m_text; }
+
+ private:
+ Text m_text;
+ };
+
+ Paragraph(NonnullOwnPtrVector<Line>&& lines)
+ : m_lines(move(lines))
{
}
+
virtual ~Paragraph() override { }
virtual String render_to_html() const override;
virtual String render_for_terminal(size_t view_width = 0) const override;
- static OwnPtr<Paragraph> parse(Vector<StringView>::ConstIterator& lines);
+
+ void add_line(NonnullOwnPtr<Line>&& line);
private:
- Text m_text;
+ NonnullOwnPtrVector<Line> m_lines;
};
}