mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
LibMarkdown: Change MD Document parse API to return a RefPtr
Markdown documents are now obtained via the static Document::parse method, which returns a RefPtr<Document>, or nullptr on failure.
This commit is contained in:
parent
9a2177437b
commit
7ca562b200
8 changed files with 28 additions and 28 deletions
|
@ -70,14 +70,13 @@ int main(int argc, char* argv[])
|
|||
dbg() << "Read size " << buffer.size();
|
||||
|
||||
auto input = String::copy(buffer);
|
||||
Markdown::Document document;
|
||||
success = document.parse(input);
|
||||
auto document = Markdown::Document::parse(input);
|
||||
|
||||
if (!success) {
|
||||
if (!document) {
|
||||
fprintf(stderr, "Error parsing\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
String res = html ? document.render_to_html() : document.render_for_terminal();
|
||||
String res = html ? document->render_to_html() : document->render_for_terminal();
|
||||
printf("%s", res.characters());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue