Skip to content

Commit

Permalink
fix(core): replace flattened mdx content by rules
Browse files Browse the repository at this point in the history
  • Loading branch information
10Derozan committed Mar 25, 2024
1 parent 2eb28ec commit 8ebf9a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-pumpkins-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rspress/core': patch
---

fix(core): replace flattened mdx content by rules
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"remark-rehype": "^10.1.0",
"rspack-plugin-virtual-module": "0.1.12",
"source-map": "0.7.4",
"string-replace-loader": "^3.1.0",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.1",
"unist-util-visit-children": "^2.0.1",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/node/mdx/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
normalizePath,
escapeMarkdownHeadingIds,
flattenMdxContent,
applyReplaceRules,
} from '../utils';
import { PluginDriver } from '../PluginDriver';
import { TEMP_DIR } from '../constants';
Expand Down Expand Up @@ -111,8 +112,10 @@ export default async function mdxLoader(
filepath,
alias as Record<string, string>,
);
// replace content
const replacedContent = applyReplaceRules(flattenContent, config.replaceRules);
// preprocessor
const preprocessedContent = escapeMarkdownHeadingIds(flattenContent);
const preprocessedContent = escapeMarkdownHeadingIds(replacedContent);

deps.forEach(dep => context.addDependency(dep));

Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8ebf9a2

Please sign in to comment.