From f259d13753cb97dcd43022de9d813efb2e5a4348 Mon Sep 17 00:00:00 2001 From: John Holdun Date: Wed, 10 Aug 2022 15:31:08 -0700 Subject: [PATCH] feat: Add figcaption to list of non-convertible span parents (#682) 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 b299d11b..0ec49252 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'); } });