diff --git a/frontend/ui/wikipedia.lua b/frontend/ui/wikipedia.lua
index b7ccf886c..a94bb7381 100644
--- a/frontend/ui/wikipedia.lua
+++ b/frontend/ui/wikipedia.lua
@@ -1453,12 +1453,12 @@ abbr.abbr {
if self.wiki_prettify then
-- Prepend some symbols to section titles for a better visual feeling of hierarchy
- html = html:gsub("
", " "..h1_sym.." ")
- html = html:gsub("", " "..h2_sym.." ")
- html = html:gsub("", " "..h3_sym.." ")
- html = html:gsub("", " "..h4_sym.." ")
- html = html:gsub("", " "..h5_sym.." ")
- html = html:gsub("", " "..h6_sym.." ")
+ html = html:gsub("(]*>)", "%1 "..h1_sym.." ")
+ html = html:gsub("(]*>)", "%1 "..h2_sym.." ")
+ html = html:gsub("(]*>)", "%1 "..h3_sym.." ")
+ html = html:gsub("(]*>)", "%1 "..h4_sym.." ")
+ html = html:gsub("(]*>)", "%1 "..h5_sym.." ")
+ html = html:gsub("(]*>)", "%1 "..h6_sym.." ")
end
-- Note: in all the gsub patterns above, we used lowercase for tags and attributes