Skip to content
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

feat: Markdown里支持通过变量替换文本 #2008

Closed
alienzhangyw opened this issue Jan 12, 2024 · 4 comments
Closed

feat: Markdown里支持通过变量替换文本 #2008

alienzhangyw opened this issue Jan 12, 2024 · 4 comments

Comments

@alienzhangyw
Copy link

我想通过设置自定义环境变量的方式,在编译时全局替换多个md文件中的一些文本,这个要能否实现?
我在讨论里提出了一些思路。

Originally posted by @alienzhangyw in #1985

@Wxh16144
Copy link
Member

原始需求是啥🤔,或者可以写一个 remark 插件然后自己用 正则表达式去 replaceAll

@alienzhangyw
Copy link
Author

原始需求是啥🤔,或者可以写一个 remark 插件然后自己用 正则表达式去 replaceAll

原始需求就是要做OEM产品,文档里的图片、文字、URL等可以快速替换而不用修改源代码。所以想通过编译时载入环境变量的方式替换md文件里的文本和URL等。

@Wxh16144
Copy link
Member

Wxh16144 commented May 6, 2024

可以写一个 remark 插件然后自己用 正则表达式去 replaceAll

这个可以满足你的需求

@alienzhangyw
Copy link
Author

可以写一个 remark 插件然后自己用 正则表达式去 replaceAll

这个可以满足你的需求

我已经改用Docusaurus了,参考这个facebook/docusaurus#395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants