mirror of
https://github.com/miniflux/v2.git
synced 2025-08-21 18:11:09 +00:00
fix(readability): do not remove elements within code blocks
`<span class="hljs-comment"># exit 1</span>` will match the `unlikelyCandidatesRegexp` because it contains the `comment` string.
This commit is contained in:
parent
491d51c95f
commit
6d58052504
2 changed files with 27 additions and 0 deletions
|
@ -162,6 +162,11 @@ func removeUnlikelyCandidates(document *goquery.Document) {
|
|||
return
|
||||
}
|
||||
|
||||
// Don't remove elements within code blocks (pre or code tags)
|
||||
if s.Closest("pre, code").Length() > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if class, ok := s.Attr("class"); ok {
|
||||
if shouldRemove(class) {
|
||||
s.Remove()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue