summaryrefslogtreecommitdiff
path: root/Applications/Help/main.cpp
diff options
context:
space:
mode:
authorFalseHonesty <thefalsehonesty@gmail.com>2020-05-18 16:58:00 -0400
committerAndreas Kling <kling@serenityos.org>2020-05-30 00:32:12 +0200
commit20faa93cb0371c033a2e8ba8271aec5ef4dd6dfe (patch)
treee9976e07d67d8f893790c79725dbd06f9b95842d /Applications/Help/main.cpp
parent7ca562b200e9a15bc02bdd23f5c9faedf53e6a26 (diff)
downloadserenity-20faa93cb0371c033a2e8ba8271aec5ef4dd6dfe.zip
LibMarkdown: Change internal MD API to return OwnPtrs
Previously, all Markdown blocks had a virtual parse method which has been swapped out for a static parse method returning an OwnPtr of that block's type. The Text class also now has a static parse method that will return an Optional<Text>.
Diffstat (limited to 'Applications/Help/main.cpp')
-rw-r--r--Applications/Help/main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp
index ffe41c3e69..903f23e5b5 100644
--- a/Applications/Help/main.cpp
+++ b/Applications/Help/main.cpp
@@ -128,10 +128,13 @@ int main(int argc, char* argv[])
auto buffer = file->read_all();
StringView source { (const char*)buffer.data(), buffer.size() };
- auto md_document = Markdown::Document::parse(source);
- ASSERT(md_document);
+ String html;
+ {
+ auto md_document = Markdown::Document::parse(source);
+ ASSERT(md_document);
+ html = md_document->render_to_html();
+ }
- String html = md_document->render_to_html();
auto html_document = Web::parse_html_document(html);
page_view.set_document(html_document);