Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Sep 17, 2023
1 parent e0a8644 commit cfaab18
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/loaders/markdown/transformer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import type { ILocalesConfig, IRouteMeta } from '@/client/theme-api/types';
import { VERSION_2_DEPRECATE_SOFT_BREAKS } from '@/constants';
import type { IApi, IDumiConfig, IDumiTechStack } from '@/types';
import enhancedResolve from 'enhanced-resolve';
import path from 'path';
import type { IRoute } from 'umi';
import { semver } from 'umi/plugin-utils';
import { semver, winPath } from 'umi/plugin-utils';
import type { Plugin, Processor } from 'unified';
import type { Data } from 'vfile';
import rehypeDemo from './rehypeDemo';
Expand Down Expand Up @@ -197,6 +198,13 @@ export default async (raw: string, opts: IMdTransformerOptions) => {
}),
);

// information is stored in an object.
processor.data({
...(processor.data() ?? {}),
filename: winPath(path.relative(opts.cwd, opts.fileAbsPath)),
fileAbsPath: opts.fileAbsPath,
});

const result = await processor.use(rehypeJsxify).process(raw);

return {
Expand Down

0 comments on commit cfaab18

Please sign in to comment.