From e944b49e401eb2b44dde255dad9bf1b419dfdec1 Mon Sep 17 00:00:00 2001 From: John Holdun Date: Wed, 10 Aug 2022 15:27:47 -0700 Subject: [PATCH] feat: Add figcaption to list of non-convertible span parents Based on this comment: https://github.com/postlight/mercury-parser/issues/530#issuecomment-580105171 --- src/utils/dom/convert-to-paragraphs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/dom/convert-to-paragraphs.js b/src/utils/dom/convert-to-paragraphs.js index b299d11bf..0ec492524 100644 --- a/src/utils/dom/convert-to-paragraphs.js +++ b/src/utils/dom/convert-to-paragraphs.js @@ -5,9 +5,9 @@ import { DIV_TO_P_BLOCK_TAGS } from './constants'; function convertDivs($) { $('div').each((index, div) => { const $div = $(div); - const convertable = $div.children(DIV_TO_P_BLOCK_TAGS).length === 0; + const convertible = $div.children(DIV_TO_P_BLOCK_TAGS).length === 0; - if (convertable) { + if (convertible) { convertNodeTo($div, $, 'p'); } }); @@ -18,8 +18,8 @@ function convertDivs($) { function convertSpans($) { $('span').each((index, span) => { const $span = $(span); - const convertable = $span.parents('p, div, li').length === 0; - if (convertable) { + const convertible = $span.parents('p, div, li, figcaption').length === 0; + if (convertible) { convertNodeTo($span, $, 'p'); } });