Skip to content

Commit

Permalink
feat: add zh docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyuan0704 committed Sep 30, 2022
1 parent c4b34ba commit 8615a61
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 158 deletions.
23 changes: 11 additions & 12 deletions docs/zh/api/config-basic.md
@@ -1,13 +1,11 @@
# Basic Config
# 基础配置

## base

- Type: `string`
- Default: `/`

The base URL the site will be deployed at. You can set this to a subdirectory if you plan to deploy your site to a subdirectory of your domain.

For example, if you plan to deploy your site to `https://foo.github.io/bar/`, then you should set `base` to `"/bar/"`:
部署基准路径。比如,如果你计划将你的站点部署到 `https://foo.github.io/bar/`,那么你应该将 `base` 设置为 `"/bar/"`

```js
import { defineConfig } from 'islandjs';
Expand All @@ -22,13 +20,13 @@ export default defineConfig({
- Type: `string`
- Default: `"Island"`

The title of the site. This will be used as the title of the home page and the title of the HTML document. For example:
站点标题。这个参数将被用作 HTML 页面的标题。例如:

```js
import { defineConfig } from 'islandjs';

export default defineConfig({
title: 'my-site'
title: '我的站点'
});
```

Expand All @@ -37,13 +35,13 @@ export default defineConfig({
- Type: `string`
- Default: `""`

The description of the site. This will be used as the description of the home page and the description of the HTML document. For example:
站点描述。这将用作 HTML 页面的描述。例如:

```js
import { defineConfig } from 'islandjs';

export default defineConfig({
description: 'This is my site.'
description: '这是我的站点'
});
```

Expand All @@ -52,7 +50,7 @@ export default defineConfig({
- Type: `string`
- Default: `""`

The icon of the site. This will be used as the icon of the home page and the icon of the HTML document. For example:
站点图标。这个路径将用作 HTML 页面的图标路径。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -62,19 +60,20 @@ export default defineConfig({
});
```

Then Island.js will find your icon in the `public` directory.
然后 Island.js 会在 `public` 目录中找到你的图标。

## appearance

- Type: `boolean`
- Default: `true`

Whether to appear the dark mode/light mode toggle button. For example:
是否出现暗黑模式/白天模式切换按钮。比如:

```js
import { defineConfig } from 'islandjs';

export default defineConfig({
// 不出现这个按钮
appearance: false
});
```
Expand All @@ -84,7 +83,7 @@ export default defineConfig({
- Type: `string`
- Default: `.island/dist`

The output directory for the built site. For example:
自定义构建站点的输出目录。比如:

```js
import { defineConfig } from 'islandjs';
Expand Down
46 changes: 23 additions & 23 deletions docs/zh/api/config-extension.md
@@ -1,13 +1,13 @@
# Extension Config
# 扩展配置

The extension config means that how to configure the build tool(Vite), the conventional route, the markdown parser and so on.
扩展配置是指如何配置构建工具(Vite)、常规路由、markdown 解析器等。

## vite

- Type: `Object`
- Default: `{}`

The custom config for [Vite](https://vitejs.dev/config/).And the config you passed in will be merged deeply with the default config of Vite. For example:
[Vite]的自定义配置(https://vitejs.dev/config/)。你传入的配置将与Vite的默认配置深度合并。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -26,14 +26,14 @@ export default defineConfig({

- Type: `Object`

The conventional route custom config.The ability is implemented by a vite plugin.You can pass in the following options to customize the plugin behavior:
自定义路由自定义配置。该能力是通过一个 Vite 插件实现的。你可以传入以下选项来自定义插件的行为:

### route.include

- Type: `string[]`
- Default: `[]`

Add some extra files to the routing. By default, only the files in the root directory and all subdirectories will be included in the routing. If you want to add some extra files to the routing, you can use this option. For example:
在路由中添加一些额外的文件。默认情况下,只有根目录和所有子目录中的文件才会包含在路由中。如果你想在路由中添加一些额外的文件,你可以使用这个选项。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -45,14 +45,14 @@ export default defineConfig({
});
```

> Notice: the string in the array supports glob pattern.
> 注意:数组中的字符串支持 glob 模式。
### route.exclude

- Type: `string[]`
- Default: `[]`

Exclude some files from the routing. For example:
从路由中排除一些文件。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -64,14 +64,14 @@ export default defineConfig({
});
```

> Notice: the string in the array supports glob pattern.
> 注意:数组中的字符串支持 glob 模式。
### route.extensions

- Type: `string[]`
- Default: `[]`

The extensions of the files that will be included in the routing. By default, Island.js will include all the `'js','jsx','ts','tsx','md','mdx'` files in the routing. If you want to add some extra extensions, you can use this option. For example:
将包含在路由中的文件的扩展名。默认情况下,Island.js 会在路由中包含所有 `'js''jsx''ts''tsx''md''mdx' 文件。如果你想添加一些额外的扩展,你可以使用这个选项。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -88,7 +88,7 @@ export default defineConfig({
- Type: `string`
- Default: ``

The prefix of the filepath that will be converted to a route. For example:
将被转换为路由的文件路径的前缀。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -100,13 +100,13 @@ export default defineConfig({
});
```

Then the filepath `pages/foo/bar.md` in root dir will be converted to the route `/foo/bar`.
比如根目录中的文件路径 `pages/foo/bar.md` 将被转换为路由 `/foo/bar`

### route.root

- Type: `string`

The root dir of the routing. By default, the root dir is the param you specify in island cli command. If you want to change the root dir, you can use this option. For example:
路由的根目录。默认情况下,根目录是你在 island cli 命令中指定的参数。如果要更改根目录,可以使用此选项。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -122,20 +122,20 @@ export default defineConfig({

- Type: `Object`

The options for remark and rehype plugins.
remark rehype 插件的选项。

### markdown.remarkPlugins

- Type: `Array`
- Default: `[]`

The remark plugins that will be used to parse markdown files. There are following plugins that will be used by default:
用于解析 markdown 文件的备注插件。默认情况下将使用以下插件:

- [remark-gfm](https://www.npmjs.com/package/remark-gfm): Parse common markdown syntaxes `GFM`(GitHub Flavored Markdown).
- [remark-frontmatter](https://www.npmjs.com/package/remark-frontmatter): Parse front matter info in markdown files.
- [remark-mdx-frontmatter](https://www.npmjs.com/package/remark-mdx-frontmatter): Parse front matter info in mdx files.
- [remark-gfm](https://www.npmjs.com/package/remark-gfm): 解析常用 markdown 语法 `GFM`(GitHub Flavored Markdown)
- [remark-frontmatter](https://www.npmjs.com/package/remark-frontmatter): 解析 Markdown 文件中的 Front Matter 信息。
- [remark-mdx-frontmatter](https://www.npmjs.com/package/remark-mdx-frontmatter): 解析 MDX 文件中的 Front Matter 信息。

You can also use this option to add some extra remark plugins. For example:
你还可以使用此选项添加一些额外的 remark 插件。例如:

```js
import { defineConfig } from 'islandjs';
Expand All @@ -154,13 +154,13 @@ export default defineConfig({
- Type: `Array`
- Default: `[]`

The rehype plugins that will be used to parse HTML. There are following plugins that will be used by default:
将用于解析 HTML 的 rehype 插件。默认情况下将使用以下插件:

- [rehype-autolink-headings](https://www.npmjs.com/package/rehype-autolink-headings): Add anchor to headings.
- [rehype-slug](https://www.npmjs.com/package/rehype-slug): Add id to headings.
- [rehype-external-links](https://www.npmjs.com/package/rehype-external-links): Add `target="_blank"` to external links.
- [rehype-autolink-headings](https://www.npmjs.com/package/rehype-autolink-headings): 向标题添加锚点(a 标签)。
- [rehype-slug](https://www.npmjs.com/package/rehype-slug): 在标题中添加 id
- [rehype-external-links](https://www.npmjs.com/package/rehype-external-links): `target="_blank"` 添加到外部链接。

You can also use this option to add some extra rehype plugins. For example:
你还可以使用此选项添加一些额外的 rehype 插件。例如:

```js
import { defineConfig } from 'islandjs';
Expand Down
22 changes: 11 additions & 11 deletions docs/zh/api/config-front-matter.md
@@ -1,26 +1,26 @@
# Front Matter Config
# Front Matter 配置

## title

- Type: `string`

The title of the page. By default, the h1 title of the page will be used as the title of the HTML document. But if you want to use a different title, you can use the `title` front matter to specify the title of the page. For example:
页面的标题。默认情况下,页面的 h1 标题将用作 HTML 文档的标题。但是如果你想使用不同的标题,你可以使用 Front Matter 来指定页面的标题。例如:

```md
---
title: My Page
title: 我的主页
---
```

## description

- Type: `string`

The custom description of the page. For example:
页面的自定义描述。例如:

```md
---
description: This is my page.
description: 这是我的主页
---
```

Expand All @@ -29,7 +29,7 @@ description: This is my page.
- Type: `'home' | 'doc' | 'api' | 'custom' | '404'`
- Default: `'doc'`

The type of the page. By default, the page type is `'doc'`. But if you want to use a different page type, you can use the `pageType` front matter to specify the page type. For example:
页面的类型。默认情况下,页面类型为`doc`。但是如果你想使用不同的页面类型,你可以使用`pageType`前面的东西来指定页面类型。例如:

```md
---
Expand All @@ -42,7 +42,7 @@ pageType: home
- Type: `boolean`
- Default: `false`

Enable api page.It's equal to `pageType: 'api'`:
表示当前页为 api 页面。相当于`pageType: 'api'`

```md
---
Expand All @@ -54,7 +54,7 @@ api: true

- Type: `Object`

The hero config of `home` page. It has following type:
`home` 页面的 hero 配置。它有以下类型:

```ts
export interface Hero {
Expand All @@ -73,7 +73,7 @@ export interface Hero {
}
```

For example, you can use the following front matter to specify the hero config of the page:
例如,你可以使用以下 Front Matter 来指定页面的 hero config

```md
---
Expand Down Expand Up @@ -101,7 +101,7 @@ hero:
- Type: `Array`
- Default: `[]`

The features config of `home` page. It has following type:
`home` 页面的功能配置。它有以下类型:

```ts
export interface Feature {
Expand All @@ -113,7 +113,7 @@ export interface Feature {
export type Features = Feature[];
```

For example, you can use the following front matter to specify the features config of `home` page:
例如,你可以使用以下前端内容来指定 `home` 页面的 features 配置:

```md
---
Expand Down

0 comments on commit 8615a61

Please sign in to comment.