summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-09-20 18:06:40 +0430
committerAndreas Kling <kling@serenityos.org>2020-09-27 21:14:18 +0200
commit7640cb8ec417ca8c0e93c89fb59d70bdc08c5cae (patch)
tree266e524749131f4b15cbc3cd10fe67a073fcf913 /Libraries
parent445bd865339b81e7cba825eec1035f20cb564cb8 (diff)
downloadserenity-7640cb8ec417ca8c0e93c89fb59d70bdc08c5cae.zip
LibMarkdown: Add a Text(String) constructor
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibMarkdown/Text.cpp5
-rw-r--r--Libraries/LibMarkdown/Text.h1
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;