Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/content/docs/zh-cn/guides/integrations-guide/markdoc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ category: other
i18nReady: true
---

import { FileTree } from '@astrojs/starlight/components';
import { FileTree, Steps } from '@astrojs/starlight/components';
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';
import { Steps } from '@astrojs/starlight/components';
import ReadMore from '~/components/ReadMore.astro';
import Since from '~/components/Since.astro';

这个 **[Astro 集成][astro-integration]** 允许使用 [Markdoc](https://markdoc.dev/) 来创建组件、页面和内容集合条目。

Expand Down Expand Up @@ -585,6 +585,13 @@ Astro Markdoc 集成处理了在 `markdoc.config.js` 文件中不可用的 Markd

### `allowHTML`

<p>

**类型:** `boolean`<br />
**默认值:** `false`<br />
<Since v="0.4.4" pkg="@astrojs/markdoc" />
</p>

允许在 Markdoc 标签和节点旁边编写 HTML 标记。

默认情况下,Markdoc 不会将 HTML 标记识别为语义内容。
Expand All @@ -607,6 +614,13 @@ Astro Markdoc 集成处理了在 `markdoc.config.js` 文件中不可用的 Markd

### `ignoreIndentation`

<p>

**类型:** `boolean`<br />
**默认值:** `false`<br />
<Since v="0.7.0" pkg="@astrojs/markdoc" />
</p>

默认情况下,任何使用四个空格缩进的内容都会被视为代码块。不幸的是,这种行为使得在具有复杂结构的文档中用任意级别的缩进来提高可读性变得困难。

在使用 Markdoc 的嵌套标签时,将标签内的内容缩进可以帮助清楚地显示层级深度。为了支持任意缩进,我们需要禁用基于缩进的代码块,并修改几个其他的 markdown-it 解析规则,以忽略缩进的代码块。即通过启用 ignoreIndentation 选项可以应用这些修改。
Expand Down
29 changes: 25 additions & 4 deletions src/content/docs/zh-cn/guides/integrations-guide/mdx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,12 @@ MDX 不支持以字符串形式传递备注和 rehype 插件。你应该安装

### `extendMarkdownConfig`

* **类型:** `boolean`
* **默认值:** `true`
<p>

**类型:** `boolean`<br />
**默认值:** `true`<br />
<Since v="0.15.0" pkg="@astrojs/mdx" />
</p>

MDX 将默认扩展[你的项目现有的 Markdown 配置](/zh-cn/reference/configuration-reference/#markdown-选项)。要覆盖个别选项,你可以在你的 MDX 配置中进行等价配置。

Expand Down Expand Up @@ -325,13 +329,26 @@ export default defineConfig({

### `recmaPlugins`


<p>

**类型:** `PluggableList`<br />
**默认值:** `[]`<br />
<Since v="0.11.5" pkg="@astrojs/mdx" />
</p>

这些是直接修改输出 [estree](https://github.com/estree/estree) 的插件。这对于在你的 MDX 文件中修改或注入 JavaScript 变量很有用。

我们建议[使用 AST Explorer](https://astexplorer.net/)来处理 estree 的输出,并尝试 [`estree-util-visit`](https://unifiedjs.com/explore/package/estree-util-visit/) 来搜索整个 JavaScript 节点。

### optimize

* **类型:** `boolean | { ignoreElementNames?: string[] }`
<p>

**类型:** `boolean | { ignoreElementNames?: string[] }`<br />
**默认值:** `false`<br />
<Since v="0.19.5" pkg="@astrojs/mdx" />
</p>

这是一个可选的配置设置,用于优化 MDX 输出,以便通过内部 rehype 插件加快构建和渲染速度。如果你的 MDX 文件较多,并注意到构建速度较慢,这可能会很有用。不过,该选项可能会生成一些未转义的 HTML,因此请确保你网站的交互式部分在启用该选项后仍能正常工作。

Expand All @@ -353,7 +370,11 @@ export default defineConfig({

#### ignoreElementNames

* **类型:** `string[]`
<p>

**类型:** `string[]`<br />
<Since v="3.0.0" pkg="@astrojs/mdx" />
</p>

<p><Since pkg="@astrojs/mdx" v="3.0.0" /></p>
以前称为 `customComponentNames`。
Expand Down
16 changes: 13 additions & 3 deletions src/content/docs/zh-cn/guides/integrations-guide/preact.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ Astro Preact 集成处理了 Preact 组件的渲染,并具有自己的选项

对于基本用法,你无需配置 Preact 集成。

### 兼容
### `compat`

<p>

**类型:** `boolean`<br />
<Since pkg="@astrojs/preact" v="0.3.0" />
</p>

你可以启用 `preact/compat`,这是 Preact 的兼容层,用于在不需要安装或将 React 的较大库发送到用户的网络浏览器的情况下渲染 React 组件。

Expand Down Expand Up @@ -166,9 +172,13 @@ export default defineConfig({
目前,`compat` 选项只适用于 React 库,将代码以 ESM 的形式导出。如果在构建时出现错误,请尝试将该库添加到你的`vite.ssr.noExternal: ['the-react-library']` 的 `astro.config.mjs` 文件中。
:::

### 开发者工具
### `devtools`

<p><Since pkg="@astrojs/preact" v="3.3.0" /></p>
<p>

**类型:** `boolean`<br />
<Since pkg="@astrojs/preact" v="3.3.0" />
</p>

你可以通过在开发中向你的 `preact()` 集成配置传递一个包含 `devtools: true` 的对象来启用 [Preact 开发者工具](https://preactjs.github.io/preact-devtools/):

Expand Down
8 changes: 6 additions & 2 deletions src/content/docs/zh-cn/guides/integrations-guide/solid-js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ export default defineConfig({

## 配置

### 开发者工具
### `devtools`

<p><Since pkg="@astrojs/solid-js" v="4.2.0" /></p>
<p>

**类型:** `boolean`<br />
<Since pkg="@astrojs/solid-js" v="4.2.0" />
</p>

在开发中,你可以通过向你的 `solid()` 集成配置传递一个包含 `devtools: true` 的对象,并将 `solid-devtools` 添加到你的项目依赖中,来启用 [Solid 开发者工具](https://github.com/thetarnav/solid-devtools):

Expand Down
23 changes: 19 additions & 4 deletions src/content/docs/zh-cn/guides/integrations-guide/vue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ export default defineConfig({
});
```

### appEntrypoint
### `appEntrypoint`

<p>

**类型:** `string`<br />
<Since pkg="@astrojs/vue" v="1.2.0" />
</p>

你可以拓展 Vue `app` 实例并将 `appEntrypoint` 选项设置为一个相对根目录的导入标识符 (例如: `appEntrypoint: "/src/pages/_app"`)。

Expand All @@ -165,7 +171,13 @@ export default (app: App) => {
};
```

### jsx
### `jsx`

<p>

**类型:** `boolean | object`<br />
<Since pkg="@astrojs/vue" v="1.2.0" />
</p>

你可以通过设置 `jsx: true` 来使用 Vue JSX。

Expand Down Expand Up @@ -197,9 +209,12 @@ export default defineConfig({
],
});
```
### 开发者工具
### `devtools`

<p><Since pkg="@astrojs/vue" v="4.2.0" /></p>
<p>
**类型:** `boolean | object`<br />
<Since pkg="@astrojs/vue" v="4.2.0" />
</p>

你可以在开发中通过在 `vue()` 集成配置中传递一个对象 `devtools: true` 来启用 [Vue DevTools](https://devtools-next.vuejs.org/):

Expand Down