diff --git a/src/api/embedsApi.ts b/src/api/embedsApi.ts index cab900f3..6619967f 100644 --- a/src/api/embedsApi.ts +++ b/src/api/embedsApi.ts @@ -246,10 +246,7 @@ const fetchConceptVisualElement = async ( opts: TransformOptions, ): Promise => { if (!visualElement) return undefined; - const html = load(visualElement, { - xmlMode: false, - decodeEntities: false, - }); + const html = load(visualElement, {}); const embed = getEmbedsFromContent(html)[0]; if (!embed) return undefined; const res = await transformEmbed(embed, context, index + 0.1, 0, { @@ -325,14 +322,7 @@ const endsWithPunctuationRegex = /[.!?]$/; export const parseCaption = (caption: string): string => { const htmlCaption = parseMarkdown({ markdown: caption, inline: true }); - const parsedCaption = load( - htmlCaption, - { - xmlMode: false, - decodeEntities: false, - }, - false, - ); + const parsedCaption = load(htmlCaption, {}, false); const lastTextNode = parsedCaption.root().contents().last(); diff --git a/src/api/resourceEmbedApi.ts b/src/api/resourceEmbedApi.ts index a54c431f..75748dcd 100644 --- a/src/api/resourceEmbedApi.ts +++ b/src/api/resourceEmbedApi.ts @@ -108,10 +108,7 @@ export const fetchResourceEmbed = async ( const embedHtml = toEmbedHtml(embed); const content = toHtml(embedHtml); - const html = load(content, { - xmlMode: false, - decodeEntities: false, - }); + const html = load(content, {}); const embeds = getEmbedsFromContent(html)[0]; if (!embeds) { throw new Error("No embeds found"); @@ -133,10 +130,7 @@ export const fetchResourceEmbeds = async ({ resources }: GQLQueryResourceEmbedsA const embeds = resources.map((params) => toEmbed(params)).filter((embed) => !!embed); const content = embeds.map((embed) => toEmbedHtml(embed!)).join(""); const bodyString = toHtml(content); - const html = load(bodyString, { - xmlMode: false, - decodeEntities: false, - }); + const html = load(bodyString, {}); const embedsFromContent = getEmbedsFromContent(html); const embedPromises = await Promise.all( diff --git a/src/api/transformArticleApi.ts b/src/api/transformArticleApi.ts index 2e6dda66..7b506815 100644 --- a/src/api/transformArticleApi.ts +++ b/src/api/transformArticleApi.ts @@ -101,10 +101,7 @@ export const transformArticle = async ( visualElement: string | undefined, { subject, previewH5p, showVisualElement, draftConcept, absoluteUrl, prettyUrl }: TransformArticleOptions, ) => { - const html = load(content, { - xmlMode: false, - decodeEntities: false, - }); + const html = load(content, {}); html("math").each((_, el) => { html(el) .attr("data-math", html(el).html() ?? "") @@ -123,13 +120,7 @@ export const transformArticle = async ( html("body").prepend(`
${visualElement}
`); } - const visEl = - visualElement && !showVisualElement - ? load(`${visualElement}`, { - xmlMode: false, - decodeEntities: false, - }) - : undefined; + const visEl = visualElement && !showVisualElement ? load(`${visualElement}`, {}) : undefined; const embeds = visEl ? getEmbedsFromContent(visEl).concat(getEmbedsFromContent(html)) : getEmbedsFromContent(html);