mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 10:18:51 +00:00
The previous Text::parse was not able to give up on parsing a textual element, and just leave it as plain text. Because this is a very important part of markdown, I fully rewrote the parser to support this without having to backtrack. Also the parser now some other little features, such ast delimiter runs and flanking.
29 lines
602 B
C++
29 lines
602 B
C++
/*
|
|
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/StringBuilder.h>
|
|
#include <LibMarkdown/Paragraph.h>
|
|
|
|
namespace Markdown {
|
|
|
|
String Paragraph::render_to_html() const
|
|
{
|
|
StringBuilder builder;
|
|
builder.append("<p>");
|
|
builder.append(m_text.render_to_html());
|
|
builder.append("</p>\n");
|
|
return builder.build();
|
|
}
|
|
|
|
String Paragraph::render_for_terminal(size_t) const
|
|
{
|
|
StringBuilder builder;
|
|
builder.append(m_text.render_for_terminal());
|
|
builder.append("\n\n");
|
|
return builder.build();
|
|
}
|
|
|
|
}
|