mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
xwiki html import cleanup (#1969)
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user