1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

LibMarkdown: Convert render_to_terminal to String

This commit converts render_to_terminal from DeprecatedString to return
an ErrorOr<String>. This is to aid moving `man` away from
DeprecatedString.

I have opted not to convert render_to_html and render_to_inline_html for
now to keep this commit as small as possible.
This commit is contained in:
Carwyn Nelson 2023-06-13 16:15:13 +01:00 committed by Jelle Raaijmakers
parent e247da507f
commit e44abaa777
4 changed files with 14 additions and 8 deletions

View file

@ -43,15 +43,15 @@ DeprecatedString Document::render_to_inline_html() const
return m_container->render_to_html();
}
DeprecatedString Document::render_for_terminal(size_t view_width) const
ErrorOr<String> Document::render_for_terminal(size_t view_width) const
{
StringBuilder builder;
for (auto& line : m_container->render_lines_for_terminal(view_width)) {
builder.append(line);
builder.append("\n"sv);
TRY(builder.try_append(line));
TRY(builder.try_append("\n"sv));
}
return builder.to_deprecated_string();
return builder.to_string();
}
RecursionDecision Document::walk(Visitor& visitor) const