Skip to content

Commit dd92209

Browse files
committed
create verso.md & test admonition block
1 parent 9b81141 commit dd92209

4 files changed

Lines changed: 84 additions & 6 deletions

File tree

docs/assets/css/admonition-def.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.md-typeset .admonition.note > .admonition-title {
2+
display: inline-block;
3+
padding: .15rem .5rem;
4+
border-radius: 999px;
5+
font-weight: 700;
6+
background: var(--md-default-fg-color--lightest);
7+
color: var(--md-default-fg-color);
8+
border: 1px solid var(--md-default-fg-color--lighter);
9+
}

docs/projects/verso.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# 使用 Verso 在 Lean 中编写文档
2+
3+
(WIP)
4+
5+
原文:[https://github.com/leanprover/verso](https://github.com/leanprover/verso)
6+
7+
作者:David Thrane Christiansen 译者:子鱼 subfishzhou@gmail.com
8+
9+
Verso 是用于撰写 Lean 文档的构建框架+具体工具。 你可以使用它来实现多种技术文档,包括但不限于:
10+
- 参考手册
11+
- 教程
12+
- 网页
13+
- 学术论文
14+
15+
它能够显示 Lean 代码、提供测试以避免文档年久失修、提供超链接等。它能够支持线性或链接错综的文档结构,提供交互,以及导出PDF。
16+
17+
Verso由以下组件构成:
18+
19+
**标记语言** 一种 Markdown 的简化变体,同时是 Lean 本身的另一种具体语法,因此 Verso 文档也是 Lean 文件。正如 TeX、Sphinx 和 Scribble 允许使用自己的编程语言扩展他们的语言一样,Verso 的标记语言是可扩展的。你可以在文件顶部定义一个 Lean 函数,随后在该文件的文本中使用它。
20+
21+
**可扩展的文档结构** 所有 Verso 文档都可以包含一组通用元素,例如段落、强调文本或图像。 它们还共享部分和子部分的分层结构。 这些类型可按各个流派进行扩展。
22+
23+
阐述和渲染框架
24+
Verso 提供了一种共享范例,用于将作者编写的文本转换为可读的输出。 不同的流派会产生不同的输出格式,但它们不需要重新发明轮子来解决交叉引用问题,并且它们可以从共享库中受益,以生成各种格式的输出。
25+
26+
27+
## 流派
28+
29+
!!! note "def"
30+
```lean
31+
List.forM {u v w} {m : Type u → Type v} [Monad m]
32+
{a : Type w} (as : List a) (f : a → m PUnit) : m PUnit
33+
```
34+
35+
Applies the monadic action `f` to every element in the list, in order.
36+
37+
参数说明:
38+
: **as** — 输入列表
39+
: **f** — 作用在元素上的 monadic 函数
40+
41+
参见:`List.mapM`(收集结果的变体)。
42+
43+
## Verso 标记语言
44+
45+
## 构建文档
46+
47+
## 扩展
48+
49+
## 输出格式
50+
51+
## 网页
52+
53+
## 手册和书
54+
55+
## 索引 依赖项 (请参考原文)

docs/tutorial/elan-lake.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,14 @@ mkdir your_folder_name && cd your_folder_name && lake init your_project_name
9090
your_project_name
9191
├── YourProjectName
9292
│ └── Basic.lean
93-
├── lakefile.lean
93+
├── lakefile.toml
9494
├── lean-toolchain
9595
├── Main.lean
9696
├── YourProjectName.lean
9797
└── ...
9898
```
9999

100-
101-
其中 `lakefile.lean` 是当前项目的配置文件,`lean-toolchain` 是当前项目使用的 Lean 版本。
100+
其中 `lakefile.toml` 是当前项目的配置文件,`lean-toolchain` 是当前项目使用的 Lean 版本。
102101

103102
初次让 Lean Server 运行该项目时会添加
104103

@@ -109,13 +108,23 @@ your_project_name
109108
├── lake-manifest.json
110109
```
111110

112-
如果你想在这个现有的工程中引用 Mathlib4,你需要在 `lakefile.lean` 文件尾中加入
111+
如果你想在这个现有的工程中引用 Mathlib4,你需要在 `lakefile.toml` 文件尾中加入
113112

114113
```bash
115-
require mathlib from git
116-
"https://github.com/leanprover-community/mathlib4"
114+
[[require]]
115+
name = "mathlib"
116+
git = "https://github.com/leanprover-community/mathlib4"
117+
rev = "v4.20.0"
117118
```
118119

120+
其中 `rev = "v4.20.0"` 是版本号,也可以是 `main` ,对应 Lean 4 `stable` 版本。
121+
122+
> 旧版本项目配置文件是 `lakefile.lean` ,相应地在内容中加入
123+
> ```bash
124+
> require mathlib from git
125+
> "https://github.com/leanprover-community/mathlib4" @ "v4.20.0"
126+
> ```
127+
119128
保存文件后 VS code 会提示 "Restart Lean",点不点都没关系。
120129
121130
下面要下载 Mathlib,注意让终端路径在你的项目文件夹下。如果你的网络情况好,那么在终端中运行

mkdocs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ theme:
2020
- search.share
2121
- content.code.copy
2222
- content.code.annotate
23+
- content.tooltips
2324

2425
plugins:
2526
- search:
@@ -52,11 +53,14 @@ markdown_extensions:
5253
- pymdownx.tasklist:
5354
custom_checkbox: true
5455
- pymdownx.tilde
56+
- def_list
57+
- attr_list
5558

5659
extra_javascript:
5760
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML
5861

5962
extra_css:
63+
- assets/css/admonition-def.css
6064
- assets/css/custom.css
6165
- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css
6266

@@ -87,6 +91,7 @@ nav:
8791
- Lean4web 在线编译器: projects/lean4web.md
8892
- jixia 数据分析: projects/jixia.md
8993
- Lean4Game 教程: projects/lean4game.md
94+
- Verso 教程: projects/verso.md
9095
- Mathlib4Help:
9196
- Mathlib4Help: mathlib4_help/index.md
9297
- attributes: mathlib4_help/attributes.md

0 commit comments

Comments
 (0)