Skip to content

Commit

Permalink
fix: androidauthority.com - Retain h3 tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jocmp committed Jan 14, 2025
1 parent c2bc684 commit bbf5434
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Mercury Parser Changelog

### v2.2.11 (Jan 13, 2025)

- [68e9b88a8d] - fix: androidauthority.com - Retain h3 tags (Josiah Campbell) [#41](https://github.com/jocmp/mercury-parser/pull/41)
- [c2bc68449f] - bump version v2.2.9 -> v2.2.10 (jocmp)

### v2.2.10 (Jan 11, 2025)

- [b8b4df7037] - feat: Add custom parser for mobilesyrup.com (Josiah Campbell) [#39](https://github.com/jocmp/mercury-parser/pull/39)
Expand Down
11 changes: 5 additions & 6 deletions src/extractors/custom/www.androidauthority.com/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ export const WwwAndroidauthorityComExtractor = {
selectors: [['meta[name="og:image"]', 'value']],
},

// Some pages have a nested header elements that are significant, and that the parser will
// remove if not following a paragraph. Adding this empty paragraph fixes it, and
// the empty paragraph will be removed anyway.
content: {
selectors: ['.d_Dd'],
transforms: {
ol: node => {
node.attr('class', 'mercury-parser-keep');
},
h2: $node => {
// Some pages have an element h2 that is significant, and that the parser will
// remove if not following a paragraph. Adding this empty paragraph fixes it, and
// the empty paragraph will be removed anyway.
$node.before('<p></p>');
},
h2: $node => $node.before('<p></p>'),
h3: $node => $node.before('<p></p>'),
},
clean: [
'.d_f .d_nr', // Lead image
Expand Down

0 comments on commit bbf5434

Please sign in to comment.