mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +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
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibMarkdown/BlockQuote.h>
|
||||
#include <LibMarkdown/Visitor.h>
|
||||
|
||||
|
@ -19,10 +20,10 @@ DeprecatedString BlockQuote::render_to_html(bool) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
DeprecatedString BlockQuote::render_for_terminal(size_t view_width) const
|
||||
Vector<DeprecatedString> BlockQuote::render_lines_for_terminal(size_t view_width) const
|
||||
{
|
||||
// FIXME: Rewrite the whole terminal renderer to make blockquote rendering possible
|
||||
return m_contents->render_for_terminal(view_width);
|
||||
// FIXME: Indent lines inside the blockquote
|
||||
return m_contents->render_lines_for_terminal(view_width);
|
||||
}
|
||||
|
||||
RecursionDecision BlockQuote::walk(Visitor& visitor) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue