Jupyter notebootk 支持(.ipynb 格式)
本文使用 jupyter 编写(.ipynb 格式),源文档请点击右上角编辑本页查看
jupyter-notebook插件teedoc-plugin-jupyter-notebook-parser默认可能没有使用, 需要在site_config文件中配置
"plugins": {
"teedoc-plugin-jupyter-notebook-parser":{
"from": "pypi",
"config": {
}
}
}
Markdown 元数据头
每个md文件可以添加一个头,也叫metadata(中文叫元数据),通过这些键值来设置文章信息,格式为yaml格式,当然这个文件头是可选的,也可以不写
---
title: markdown 语法
tags: teedoc, markdown, 语法
keywords: teedoc, markdown, 语法
desc: teedoc 的 markdown 语法介绍和实例
id: zh_readme
class: zh_readme
draft: false
# 以 # 号开头表示注释
---
title: 文章的标题,如果没有元数据头的话,可以使用
# 文章标题
或者
文章标题
===
keywords: 关键词,多个关键词用英文逗号,隔开,会被添加到html头中,方便搜索引擎爬取,不会显示到页面。也可以用yaml列表的格式写
keywords:
- teedoc
- markdown
- 语法
desc: 页面描述,会被添加到html头中,不会在页面显示,方便搜索引擎爬取tags: 文章标签,会显示到页面,多个标签用英文逗号,隔开,也可以用yaml列表的格式写,同keywordsid: 页面id, 会被添加到html标签中,比如<html id="zh_readme">...</html>, 通常不需要,一般在对某个页面单独自定义css的时候可能会用上,会覆盖config.json中的设置class: 页面class,多个用英文逗号,隔开,可以不设置,会覆盖config.json中的设置。比如可以通过设置这个值来达到设置特定页面的css样式。具体支持的样式见主题插件的文档layout: 页面使用的布局模板, 默认会使用主题插件里面的配置,如果你需要自定义此页面的布局, 可以设置这个参数, 路径相对于site_config中的layout_root_dir设置的路径,layout_root_dir默认为layout, 所以要使用layout/special_layout.html只需要填写special_layout.html. 布局模板语法见layout 文档date: 最后更新日期,格式如2022-09-15- 如果不设置:默认会使用文件的最后修改时间,如果是
git仓库,会自动从git获取页面最后一次提交的时间,如果没有git或者git获取失败则会从文件系统读取最后修改时间(这很可能不准确)。另外如果update填写了值,则会采用update中最新的修改日期 - 如果不想显示最后修改日期,通过设置值为
false来禁用 - 如果设置了
update值,仍然会优先使用date中的值
- 如果不设置:默认会使用文件的最后修改时间,如果是
update: 更新历史,会在文章开头生成更新历史表格,格式:
update:
- date: 2022-09-15
author: author1
version: 1.1.0
content: 更新了xxx
- date: 2022-08-05
author: author2
version: 1.0.0
content: 更新了xxx
update_open: 是否默认展开更新记录,默认为true,关闭设置为false即可。(由主题插件支持)draft: 是否为草稿,默认为false,如果设置为true,则在生成页面时会忽略此文件。
Markdown 语法
Markdown 语法可以参考 Markdown 语法,由于jupyter的语法解析器来自jupyter 官方, 可能部分.md文件已经支持了的语法 jupyter却不支持,具体可以尝试是否支持。
三级标题
四级标题
和 Markdown 页面相同,详情见 Markdown 语法 页面
三级标题2
四级标题2
链接
相对路径, index.html 文件: ../README.md, 会自动转换成index.html
相对路径,.html 文件: ./syntax_markdown.md, 会转成文档的 .html 结尾的链接
绝对路径, http 文件: https://。。。/beginner.ipynb,原链接,不会修改
相对路径,.html 文件: ./syntax_jupyter.ipynb, 会转成文档的 .html 结尾的链接
图片

代码
以下是 python 代码,可以包含执行结果,在本地使用 jupyter 或者 jupyterlab 或者 vscode 执行代码后 保存即可
print("hello")
hello
print("world\nworld")
world
world
from PIL import Image
img = Image.open("../assets/images/logo.png")
from matplotlib import pyplot as plt
print("image")
plt.figure()
plt.imshow(img)
plt.show()
print("image")
image
image
表格
| Header 1 | Header 2 |
|---|---|
Cell 1 |
Cell 2 link |
| Cell 3 | Cell 4 |
数学
支持tex和Latex语法,以及MathML标签
两种写法,
- 一种是行内内嵌,用
$符号将方程包起来,比如
质能方程 $E=mc^2$大家很熟悉吧
效果: 质能方程 $E=mc^2$大家很熟悉吧
- 另一种,块方程,用
$$将方程包起来,比如
$$
E=mc^2
$$
效果: $$ E=mc^2 $$
其他例子: 常见:
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
$$
x = {-b \pm \sqrt{b^2-4ac} \over 2a}.
$$
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a}. $$