feat(core): Add siteConfig.markdown.hooks, deprecate siteConfig.onBrokenMarkdownLinks (#11283)

This commit is contained in:
Sébastien Lorber 2025-06-24 15:51:33 +02:00 committed by GitHub
parent ef71ddf937
commit 96c38d5fdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 1580 additions and 381 deletions

View file

@ -7,7 +7,6 @@
import path from 'path';
import fs from 'fs-extra';
import logger from '@docusaurus/logger';
import {
normalizeUrl,
docuHash,
@ -158,18 +157,12 @@ export default async function pluginContentDocs(
sourceFilePath,
versionsMetadata,
);
const permalink = resolveMarkdownLinkPathname(linkPathname, {
return resolveMarkdownLinkPathname(linkPathname, {
sourceFilePath,
sourceToPermalink: contentHelpers.sourceToPermalink,
siteDir,
contentPaths: version,
});
if (permalink === null) {
logger.report(
siteConfig.onBrokenMarkdownLinks,
)`Docs markdown link couldn't be resolved: (url=${linkPathname}) in source file path=${sourceFilePath} for version number=${version.versionName}`;
}
return permalink;
},
},
});