1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +00:00

LibMarkdown: Add render_to_inline_html() to Document

This api is useful when you want to render a markdown document to HTML,
but you want to embed it in a existing html document.
This commit is contained in:
Peter Elliott 2021-08-29 13:14:48 -07:00 committed by Andreas Kling
parent 83680934e5
commit 57ec19f963
2 changed files with 12 additions and 2 deletions

View file

@ -28,13 +28,22 @@ String Document::render_to_html() const
builder.append("</head>\n");
builder.append("<body>\n");
builder.append(render_to_inline_html());
builder.append("</body>\n");
builder.append("</html>\n");
return builder.build();
}
String Document::render_to_inline_html() const
{
StringBuilder builder;
for (auto& block : m_blocks) {
auto s = block.render_to_html();
builder.append(s);
}
builder.append("</body>\n");
builder.append("</html>\n");
return builder.build();
}