xwiki html import cleanup (#1969)

This commit is contained in:
Philip Okugbe
2026-02-24 15:53:38 +00:00
committed by GitHub
parent 5de1c8e3ed
commit b5803f42da
@@ -50,6 +50,7 @@ export async function formatImportHtml(opts: {
} }
notionFormatter($, $root); notionFormatter($, $root);
xwikiFormatter($, $root);
defaultHtmlFormatter($, $root); defaultHtmlFormatter($, $root);
const backlinks = await rewriteInternalLinksToMentionHtml( const backlinks = await rewriteInternalLinksToMentionHtml(
@@ -69,6 +70,14 @@ export async function formatImportHtml(opts: {
}; };
} }
export function xwikiFormatter($: CheerioAPI, $root: Cheerio<any>) {
const $content = $root.find('#xwikicontent');
if ($content.length) {
$root.children().remove();
$root.append($content.contents());
}
}
export function defaultHtmlFormatter($: CheerioAPI, $root: Cheerio<any>) { export function defaultHtmlFormatter($: CheerioAPI, $root: Cheerio<any>) {
$root.find('a[href]').each((_, el) => { $root.find('a[href]').each((_, el) => {
const $el = $(el); const $el = $(el);