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
pull/677/head^2
John Holdun 2 years ago committed by GitHub
parent de314a9728
commit f259d13753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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');
}
});

Loading…
Cancel
Save