mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 14:12:52 +00:00
LibMarkdown: Replace inline styles in HTML with CSS in <head>
This commit is contained in:
parent
e5ec4d35ea
commit
10c19d5207
Notes:
sideshowbarker
2024-07-19 01:36:55 +09:00
Author: https://github.com/linusg
Commit: 10c19d5207
Pull-request: https://github.com/SerenityOS/serenity/pull/3886
2 changed files with 8 additions and 4 deletions
|
@ -55,10 +55,10 @@ String CodeBlock::render_to_html() const
|
||||||
if (style.emph)
|
if (style.emph)
|
||||||
builder.append("<i>");
|
builder.append("<i>");
|
||||||
|
|
||||||
if (style_language.is_null())
|
if (style_language.is_empty())
|
||||||
builder.append("<code style=\"white-space: pre;\">");
|
builder.append("<code>");
|
||||||
else
|
else
|
||||||
builder.appendf("<code style=\"white-space: pre;\" class=\"%s\">", style_language.characters());
|
builder.appendff("<code class=\"{}\">", style_language);
|
||||||
|
|
||||||
builder.append(escape_html_entities(m_code));
|
builder.append(escape_html_entities(m_code));
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,11 @@ String Document::render_to_html() const
|
||||||
|
|
||||||
builder.append("<!DOCTYPE html>\n");
|
builder.append("<!DOCTYPE html>\n");
|
||||||
builder.append("<html>\n");
|
builder.append("<html>\n");
|
||||||
builder.append("<head></head>\n");
|
builder.append("<head>\n");
|
||||||
|
builder.append("<style>\n");
|
||||||
|
builder.append("code { white-space: pre; }\n");
|
||||||
|
builder.append("</style>\n");
|
||||||
|
builder.append("</head>\n");
|
||||||
builder.append("<body>\n");
|
builder.append("<body>\n");
|
||||||
|
|
||||||
for (auto& block : m_blocks) {
|
for (auto& block : m_blocks) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue