diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-09-20 18:06:40 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-27 21:14:18 +0200 |
commit | 7640cb8ec417ca8c0e93c89fb59d70bdc08c5cae (patch) | |
tree | 266e524749131f4b15cbc3cd10fe67a073fcf913 /Libraries/LibMarkdown | |
parent | 445bd865339b81e7cba825eec1035f20cb564cb8 (diff) | |
download | serenity-7640cb8ec417ca8c0e93c89fb59d70bdc08c5cae.zip |
LibMarkdown: Add a Text(String) constructor
Diffstat (limited to 'Libraries/LibMarkdown')
-rw-r--r-- | Libraries/LibMarkdown/Text.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibMarkdown/Text.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibMarkdown/Text.cpp b/Libraries/LibMarkdown/Text.cpp index 6e1273b65f..6d0de5bca2 100644 --- a/Libraries/LibMarkdown/Text.cpp +++ b/Libraries/LibMarkdown/Text.cpp @@ -47,6 +47,11 @@ static String unescape(const StringView& text) return builder.build(); } +Text::Text(String&& text) +{ + m_spans.append({ move(text), Style {} }); +} + String Text::render_to_html() const { StringBuilder builder; diff --git a/Libraries/LibMarkdown/Text.h b/Libraries/LibMarkdown/Text.h index ca24a84a54..ee9c89a33f 100644 --- a/Libraries/LibMarkdown/Text.h +++ b/Libraries/LibMarkdown/Text.h @@ -49,6 +49,7 @@ public: Style style; }; + explicit Text(String&& text); Text(Text&& text) = default; Text() = default; |