diff options
author | Arda Cinar <kuzux92@gmail.com> | 2022-12-23 12:25:00 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-31 00:09:23 +0100 |
commit | 5cc984d74c9453fa71ea8bb2d600d5bdb9135fb4 (patch) | |
tree | d56ae55d1d3215abfab5c4da6fff92017490828f /Userland/Libraries/LibMarkdown/BlockQuote.cpp | |
parent | 7a4b912ece600ac94a9e2c5b9991475fbd0c20fd (diff) | |
download | serenity-5cc984d74c9453fa71ea8bb2d600d5bdb9135fb4.zip |
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 :^)
Diffstat (limited to 'Userland/Libraries/LibMarkdown/BlockQuote.cpp')
-rw-r--r-- | Userland/Libraries/LibMarkdown/BlockQuote.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibMarkdown/BlockQuote.cpp b/Userland/Libraries/LibMarkdown/BlockQuote.cpp index 03abca725a..6b91db1758 100644 --- a/Userland/Libraries/LibMarkdown/BlockQuote.cpp +++ b/Userland/Libraries/LibMarkdown/BlockQuote.cpp @@ -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 |