§1. 理念与特性
§2. 编辑支持
§3. 笔记的组织方式
§3.1. 子文件
§4. 页面构建
§4.1. 强嵌入与弱嵌入
§4.2. 分类和标签
§4.3. 嵌入配置
§4.4. 条件样式
§4.5. 页面产物
§5. 索引和引用
§5.1. 索引
§5.2. 站内交叉引用
§5.3. 站外交叉引用

GitHub

理念与特性

特性支持(部分特性暂未开源):

编辑支持

只要支持editor插件和lsp扩展的编辑器,都可以用来写笔记。

辅助工具(暂未开源):

笔记的组织方式

总的来说,按照树形结构组织笔记。允许使用不同的切面重新阅读整个笔记,例如,X话题既属于A也属于B,有两种组织方式:

  1. X话题单独分开成为一个文件:

              
X.typ

              
  = X topic <x-topic>

              
A.typ

              
  = A topic <a-topic>

              
  #include "X.typ"

              
B.typ

              
  = B topic <b-topic>

              
  #include "X.typ"

              
X.typ

              
  = X topic <x-topic>

              
A.typ

              
  = A topic <a-topic>

              
  #include "X.typ"

              
B.typ

              
  = B topic <b-topic>

              
  #include "X.typ"

              
X.typ

              
  = X topic <x-topic>

              
A.typ

              
  = A topic <a-topic>

              
  #include "X.typ"

              
B.typ

              
  = B topic <b-topic>

              
  #include "X.typ"

              
X.typ

              
  = X topic <x-topic>

              
A.typ

              
  = A topic <a-topic>

              
  #include "X.typ"

              
B.typ

              
  = B topic <b-topic>

              
  #include "X.typ"
  1. X话题主要属于A,并不单独成文:

              
A.typ

              
  = A topic <a-topic>

              
  == X topic <x-topic>

              
B.typ

              
  = B topic <b-topic>

              
  #remige(<x-topic>)

              
A.typ

              
  = A topic <a-topic>

              
  == X topic <x-topic>

              
B.typ

              
  = B topic <b-topic>

              
  #remige(<x-topic>)

              
A.typ

              
  = A topic <a-topic>

              
  == X topic <x-topic>

              
B.typ

              
  = B topic <b-topic>

              
  #remige(<x-topic>)

              
A.typ

              
  = A topic <a-topic>

              
  == X topic <x-topic>

              
B.typ

              
  = B topic <b-topic>

              
  #remige(<x-topic>)

此时x-topicx-topic会自动附带标签:


              
The `x-topic` belongs to (or, is tagged by) `A` and `B`.

              
The `x-topic` belongs to (or, is tagged by) `A` and `B`.

              
The `x-topic` belongs to (or, is tagged by) `A` and `B`.

              
The `x-topic` belongs to (or, is tagged by) `A` and `B`.

使用.gitignore.gitignore配置私有笔记:


              
content

              
  .gitignore // specify the private notes

              
  notes/..

              
content

              
  .gitignore // specify the private notes

              
  notes/..

              
content

              
  .gitignore // specify the private notes

              
  notes/..

              
content

              
  .gitignore // specify the private notes

              
  notes/..

提示:参考「branch-specific gitignore」以使用git VCS托管私有笔记。

子文件

Typst脚本只有一个核心概念:remigeremige,用于组织笔记内容之间的关系。


              
#let remige(to: auto, body: content | label) = todo();

              
#let remige(to: auto, body: content | label) = todo();

              
#let remige(to: auto, body: content | label) = todo();

              
#let remige(to: auto, body: content | label) = todo();

使用以下方式嵌入子笔记:


              
#include "path/to/note.typ"

              
#include "path/to/note.typ"

              
#include "path/to/note.typ"

              
#include "path/to/note.typ"

使用以下方式保证子笔记的嵌套级别和<my-topic><my-topic>的一致:


              
= My Topic <my-topic>

              
#include "path/to/note.typ"

              
--- 等同于:---

              
#remige(to: auto, include "path/to/note.typ")

              
--- 等同于:---

              
#remige(to: <my-topic>)[#include "path/to/note.typ"]

              
--- 等同于:---

              
#remige(to: <my-topic>)[

              
  = 索引 <note-taking:index>

              
  ...

              
]

              
= My Topic <my-topic>

              
#include "path/to/note.typ"

              
--- 等同于:---

              
#remige(to: auto, include "path/to/note.typ")

              
--- 等同于:---

              
#remige(to: <my-topic>)[#include "path/to/note.typ"]

              
--- 等同于:---

              
#remige(to: <my-topic>)[

              
  = 索引 <note-taking:index>

              
  ...

              
]

              
= My Topic <my-topic>

              
#include "path/to/note.typ"

              
--- 等同于:---

              
#remige(to: auto, include "path/to/note.typ")

              
--- 等同于:---

              
#remige(to: <my-topic>)[#include "path/to/note.typ"]

              
--- 等同于:---

              
#remige(to: <my-topic>)[

              
  = 索引 <note-taking:index>

              
  ...

              
]

              
= My Topic <my-topic>

              
#include "path/to/note.typ"

              
--- 等同于:---

              
#remige(to: auto, include "path/to/note.typ")

              
--- 等同于:---

              
#remige(to: <my-topic>)[#include "path/to/note.typ"]

              
--- 等同于:---

              
#remige(to: <my-topic>)[

              
  = 索引 <note-taking:index>

              
  ...

              
]

使用以下方式嵌入笔记到根话题:


              
#remige(to: none, include "path/to/note.typ")

              
#remige(to: none, include "path/to/note.typ")

              
#remige(to: none, include "path/to/note.typ")

              
#remige(to: none, include "path/to/note.typ")

页面构建

强嵌入与弱嵌入

默认所有嵌入都是尽可能是强嵌入。当嵌入关系成环时,会自动转换为弱嵌入。

分类和标签

把话题视为图的结点。强嵌入的边被称为分类,弱嵌入的边被称为标签。

嵌入配置

当本笔记作为页面构建时,可以使用regexregex配置所有的remige为强嵌入。


              
#configure-remige-embedding(

              
  (true, ),

              
  // 等价于:

              
  (regex(".*"), true),

              
)

              
#configure-remige-embedding(

              
  (true, ),

              
  // 等价于:

              
  (regex(".*"), true),

              
)

              
#configure-remige-embedding(

              
  (true, ),

              
  // 等价于:

              
  (regex(".*"), true),

              
)

              
#configure-remige-embedding(

              
  (true, ),

              
  // 等价于:

              
  (regex(".*"), true),

              
)

将来typst支持自定义元素后将变为如下语法:


              
#show: set remige(embedding: true)

              
#show: set remige(embedding: true)

              
#show: set remige(embedding: true)

              
#show: set remige(embedding: true)

复杂配置:


              
#configure-remige-embedding(

              
  (path: "path/to/note.typ", label: regex(".*"), strong: true),

              
)

              
#configure-remige-embedding(

              
  (path: "path/to/note.typ", label: regex(".*"), strong: true),

              
)

              
#configure-remige-embedding(

              
  (path: "path/to/note.typ", label: regex(".*"), strong: true),

              
)

              
#configure-remige-embedding(

              
  (path: "path/to/note.typ", label: regex(".*"), strong: true),

              
)

全局配置:

astro.config.mjsastro.config.mjs中可以配置全局配置:


              
export default defineConfig({

              
  remige: { embedding: false || true },

              
});

              
// 或复杂配置:

              
export default defineConfig({

              
  remige: {

              
    embedding: [

              
      { in: "some-topic.typ", path: "path/to/note.typ", label: /.*/, strong: true },

              
    ],

              
  },

              
});

              
export default defineConfig({

              
  remige: { embedding: false || true },

              
});

              
// 或复杂配置:

              
export default defineConfig({

              
  remige: {

              
    embedding: [

              
      { in: "some-topic.typ", path: "path/to/note.typ", label: /.*/, strong: true },

              
    ],

              
  },

              
});

              
export default defineConfig({

              
  remige: { embedding: false || true },

              
});

              
// 或复杂配置:

              
export default defineConfig({

              
  remige: {

              
    embedding: [

              
      { in: "some-topic.typ", path: "path/to/note.typ", label: /.*/, strong: true },

              
    ],

              
  },

              
});

              
export default defineConfig({

              
  remige: { embedding: false || true },

              
});

              
// 或复杂配置:

              
export default defineConfig({

              
  remige: {

              
    embedding: [

              
      { in: "some-topic.typ", path: "path/to/note.typ", label: /.*/, strong: true },

              
    ],

              
  },

              
});

条件样式

条件样式控制remige的显示方式。以下配置表示,当话题属于A时,remige会默认显示。反之,remige会以其他样式显示,默认不显示:


              
#remige-if(belongs-to: <a-topic>)[

              
  When the X topic is about A, we observe that X has some special feature.

              
]

              
#remige-if(belongs-to: <a-topic>)[

              
  When the X topic is about A, we observe that X has some special feature.

              
]

              
#remige-if(belongs-to: <a-topic>)[

              
  When the X topic is about A, we observe that X has some special feature.

              
]

              
#remige-if(belongs-to: <a-topic>)[

              
  When the X topic is about A, we observe that X has some special feature.

              
]

默认不显示:


              
#remige-if(else: (display: none), body)

              
#remige-if(else: (display: none), body)

              
#remige-if(else: (display: none), body)

              
#remige-if(else: (display: none), body)

显示为旁注:


              
#remige-if(else: (class: "footnote"), body)

              
#remige-if(else: (class: "footnote"), body)

              
#remige-if(else: (class: "footnote"), body)

              
#remige-if(else: (class: "footnote"), body)

优化:当displaydisplay设置为nonenone时,等价于:


              
#context if check-condition(belongs-to: <a-topic>) { body }

              
#context if check-condition(belongs-to: <a-topic>) { body }

              
#context if check-condition(belongs-to: <a-topic>) { body }

              
#context if check-condition(belongs-to: <a-topic>) { body }

此时在编译<b-topic><b-topic>为页面时,body不会在构建产物中。

页面产物

索引和引用

索引

JavaScript脚本可访问到站内的笔记图谱信息。

站内交叉引用

typst会自动生成交叉引用表,你可以使用引用语法引用站内其他话题,且语言服务器能帮助你正常补全此类语法。


              
@painting:philosophy[绘画哲学]

              
@painting:philosophy[绘画哲学]

              
@painting:philosophy[绘画哲学]

              
@painting:philosophy[绘画哲学]

站外交叉引用

typst默认支持bibliography引用,除此之外,还可以导入并引用其他笔记网站的索引。