mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
feat(mdx-loader): Remark plugin to report unused MDX / Markdown directives (#9394)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
56cc8e8ffa
commit
c6762a2542
19 changed files with 506 additions and 26 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
parseFrontMatter,
|
||||
escapePath,
|
||||
getFileLoaderUtils,
|
||||
getWebpackLoaderCompilerName,
|
||||
} from '@docusaurus/utils';
|
||||
import stringifyObject from 'stringify-object';
|
||||
import preprocessor from './preprocessor';
|
||||
|
@ -134,10 +135,12 @@ export async function mdxLoader(
|
|||
this: LoaderContext<Options>,
|
||||
fileString: string,
|
||||
): Promise<void> {
|
||||
const compilerName = getWebpackLoaderCompilerName(this);
|
||||
const callback = this.async();
|
||||
const filePath = this.resourcePath;
|
||||
const reqOptions: Options = this.getOptions();
|
||||
const {query} = this;
|
||||
|
||||
ensureMarkdownConfig(reqOptions);
|
||||
|
||||
const {frontMatter} = parseFrontMatter(fileString);
|
||||
|
@ -165,6 +168,7 @@ export async function mdxLoader(
|
|||
content: preprocessedContent,
|
||||
filePath,
|
||||
frontMatter,
|
||||
compilerName,
|
||||
});
|
||||
} catch (errorUnknown) {
|
||||
const error = errorUnknown as Error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue