我可以基于构建时间的变量集中在MDX文件中包含 /排除内容吗?

发布于 2025-02-01 04:26:57 字数 421 浏览 3 评论 0原文

我很喜欢使用Docusaurus,这对我来说是一个不错的变化。我正在使用Docusaurus v2.18。我希望能够从一组源文件中构建两套不同的文档。根据部署代码的环境,某些内容会有一些差异,我想将这些差异放在IF/Endif块中。我认为这是一个简单的用例,

ifeval::["{buildTarget}"=="environmentA"]
```
code block A content here
```
endif::[]

几乎

ifeval::["{buildTarget}"=="environmentB"]
```
code block B content here
```
endif::[]

所有内容都是标准的标记,但是我很高兴使用MDX / JSX包含 /排除内容。感谢您的帮助!

I am enjoying using Docusaurus, it is a nice change for me. I am using Docusaurus v2.18. I would like to be able to build two different sets of docs from one set of source files. There will be some differences in some of the content depending on the environment where the code is being deployed, and I would like to put those differences in if/endif blocks. This is what I think a simple use case would look like:

ifeval::["{buildTarget}"=="environmentA"]
```
code block A content here
```
endif::[]

and

ifeval::["{buildTarget}"=="environmentB"]
```
code block B content here
```
endif::[]

almost all of my content is standard Markdown, but I am happy to use mdx/jsx to include / exclude content. Thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文