Skip to content

Commit

Permalink
feat: improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-jerry-ye committed Jan 6, 2025
1 parent bdd0245 commit de7102b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 51 deletions.
48 changes: 6 additions & 42 deletions READEM-zh.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,11 @@
# MoonBit 文档网站

该仓库存储MoonBit的文档网站[docs.moonbitlang.cn](https://docs.moonbitlang.cn)
此存储库托管了 MoonBit 的文档网站 [docs.moonbitlang.com](https://docs.moonbitlang.com)

## 如何开始
打开 `document.code-workspace` 以获得更好的开发体验。可以从终端面板中的 `+` 号选择命令运行,或在命令面板中运行 `Tasks: Run Build Task`

我们使用[Docusaurus 3](https://docusaurus.io/)开发这个网站
## 布局

### 安装

```bash
pnpm install
```

由于我们使用了pnpm workspace, 网站相关的代码在 `moonbit-docs` 文件夹下,所以请确保接下来的命令在 `moonbit-docs` 文件夹下执行。如果您不了解如何更改文件夹,请执行:

```bash
cd moonbit-docs
```

### 本地开发

```
pnpm start -l zh
```

这个命令会启动一个本地的开发服务器并打开一个浏览器窗口。大部分改动不需要重启服务器即可实时反映出来。

### 预览

```
pnpm build -l zh && pnpm serve
```

这个命令会完成一次生产级构建并启动一个本地服务器来预览它。

## 如何撰写文档

### 修改已有的文档

文档相关的 markdown 文件保存在`moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current`文件夹下。

### 增加新的文档

1.`moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current` 文件夹下增加新的文档文件
1.`moonbit-docs/docs`文件夹下增加对应的英文文档文件,如果您不了解英文,可以只留一个占位的文件。
1.`moonbit-docs/sidebars.ts`文件中更新sidebar
- `legacy/examples` : 一些 MoonBit 的小示例。
- `next` : 基于 Sphinx 的当前文档,托管在 readthedocs 上。查看 [README](./next/README)
- `moonbit-tour` : 一个互动教程。查看 [README](./moonbit-tour/README.md)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This repository hosts the documentation website for MoonBit [docs.moonbitlang.com](https://docs.moonbitlang.com).

Open `document.code-workspace` for better development experience.
Open `document.code-workspace` for better development experience. Choose commands to run from either the `+` sign in the Terminal Panel or run `Tasks: Run Build Task` in the command palette.

## Layout

Expand Down
3 changes: 2 additions & 1 deletion document.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"options": {
"cwd": "${workspaceFolder:document}"
},
"group": "build"
"group": "build",
"problemMatcher": []
},
{
"label": "Develop Tour 开发导览",
Expand Down
22 changes: 15 additions & 7 deletions next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,32 @@ A new MoonBit docs framework based on Sphinx.

### Install

```bash
python3 -m venv .env
source .env/bin/activate
pip install -r requirements.txt
```
- For Python Environment, execute command `> Python: Create Environment` for `next` using `requirement.txt` in VSCode, or:

```bash
python3 -m venv .env
source .env/bin/activate
pip install -r requirements.txt
```

For building PDF using Latex, `latexmk` needs to be installed:
- MacOS:
- For building PDF using Latex, `latexmk` needs to be installed:
- MacOS:
- install [Mactex](https://www.tug.org/mactex/)
- install `latexmk` using TeX Live Utility

### Development

Execute task `Watch Document` in VSCode, or:

```bash
sphinx-autobuild . ./_build/html
# or sphinx-autobuild -D language='zh_CN' . ./_build/html
```

### Build

Execute task `Build Document` in VSCode, or:

```bash
make html
python3 -m http.server -d _build/html
Expand Down Expand Up @@ -54,6 +60,8 @@ make markdown

### Update translation template

Execute task `Translate Document` in VSCode, or:

```bash
make gettext
sphinx-intl update -p _build/gettext -l zh_CN
Expand Down

0 comments on commit de7102b

Please sign in to comment.