mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
LibMarkdown: Render lines to terminal instead of a single string
With this patch, the blocks in a markdown document render a vector of lines. These lines get concatenated in Document::render_to_terminal, so this does not change any external APIs of LibMarkdown. This change makes it possible to indent individual lines in the rendered markdown. So, rendering blockquotes in a similar way to code blocks :^)
This commit is contained in:
parent
7a4b912ece
commit
5cc984d74c
20 changed files with 85 additions and 55 deletions
|
@ -45,7 +45,13 @@ DeprecatedString Document::render_to_inline_html() const
|
|||
|
||||
DeprecatedString Document::render_for_terminal(size_t view_width) const
|
||||
{
|
||||
return m_container->render_for_terminal(view_width);
|
||||
StringBuilder builder;
|
||||
for (auto& line : m_container->render_lines_for_terminal(view_width)) {
|
||||
builder.append(line);
|
||||
builder.append("\n"sv);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
RecursionDecision Document::walk(Visitor& visitor) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue