提交 4e7f3da8 编写于 作者: U ULIVZ

docs(cn): update for import code snippets (#538)

上级 26ecff7d
......@@ -226,6 +226,8 @@ export default {
## Import Code Snippets
You can import code snippets from existing files via following syntax:
**Input**
```
......@@ -236,6 +238,11 @@ export default {
<<< @/test/markdown/fragments/snippet.js{2}
::: tip
Since the import of the code snippets will be executed before webpack compilation, so you can't use the path alias in webpack. the default value of `@` is `process.cwd()`.
:::
## Advanced Configuration
VuePress uses [markdown-it](https://github.com/markdown-it/markdown-it) as the markdown renderer. A lot of the extensions above are implemented via custom plugins. You can further customize the `markdown-it` instance using the `markdown` option in `.vuepress/config.js`:
......
......@@ -222,6 +222,24 @@ export default {
}
```
## 导入代码段
你可以通过下述的语法导入已经存在的文件中的代码段:
**Input**
```
<<< @/test/markdown/fragments/snippet.js{2}
```
**Output**
<<< @/test/markdown/fragments/snippet.js{2}
::: tip 注意
由于代码段的导入将在 webpack 编译之前执行,因此你无法使用 webpack 中的路径别名,此处的 `@` 默认值是 `process.cwd()`。
:::
## 进阶配置
VuePress 使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来渲染 Markdown,上述大多数的拓展也都是通过自定义的插件实现的。想要进一步的话,你可以通过 `.vuepress/config.js` 的 `markdown` 选项,来对当前的 `markdown-it` 实例做一些自定义的配置:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册