mirror of
https://github.com/discourse/discourse.git
synced 2025-03-27 04:15:37 +08:00
FIX: HtmlToMarkdown
didn't keep text from within <center>
tag
It should ignore the `<center>` tag, but keep the text from within the element.
This commit is contained in:
parent
b01905c724
commit
3c9d61d302
@ -220,7 +220,7 @@ class HtmlToMarkdown
|
||||
"\n\n#{traverse(node)}\n\n"
|
||||
end
|
||||
|
||||
TRAVERSABLES ||= %w[aside font span thead tbody tfoot u]
|
||||
TRAVERSABLES ||= %w[aside font span thead tbody tfoot u center]
|
||||
TRAVERSABLES.each { |tag| define_method("visit_#{tag}") { |node| traverse(node) } }
|
||||
|
||||
def visit_tt(node)
|
||||
|
@ -413,6 +413,10 @@ RSpec.describe HtmlToMarkdown do
|
||||
expect(html_to_markdown("<u>Underline</u>")).to eq("Underline")
|
||||
end
|
||||
|
||||
it "swallows <center>" do
|
||||
expect(html_to_markdown("<center>Centered</center>")).to eq("Centered")
|
||||
end
|
||||
|
||||
it "removes <script>" do
|
||||
expect(html_to_markdown("<script>var foo = 'bar'</script>")).to eq("")
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user