-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: share markdown absolute path with custom unified plugins #1901
refactor: share markdown absolute path with custom unified plugins #1901
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -65,6 +65,7 @@ export default function remarkMeta(opts: IRemarkMetaOpts): Transformer<Root> { | |||
title: '', | |||
toc: 'menu', | |||
filename: winPath(path.relative(opts.cwd, opts.fileAbsPath)), | |||
resourcePath: opts.fileAbsPath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议像 dumi 1 这样通过 unified 的 data 传下去,不依赖插件实现:
.data('fileAbsPath', fileAbsPath) |
内部消费用 this.data('xxx')
@@ -197,6 +198,13 @@ export default async (raw: string, opts: IMdTransformerOptions) => { | |||
}), | |||
); | |||
|
|||
// information is stored in an object. | |||
processor.data({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
先只设置单个 fileAbsPath
?应该也不需要 winPath
吧,只有要参与 webpack 编译的内容中的路径需要 winPath
This reverts commit cfaab18.
ready~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
🤔 这个变动的性质是?/ What is the nature of this change?
🔗 相关 Issue / Related Issue
💡 需求背景和解决方案 / Background or solution
📝 更新日志 / Changelog