Skip to content

网站构建

介绍

使用 Material for MkDocsMarkdown文件 渲染为 HTML网页 并使用 GitHub Pages 进行发布

跟着视频 youtube-How to set up Material for MkDocs 可以完成网页的搭建,更多个性化设置详见 Material for MkDocs 文档

遇到过的bug

When I...

  • installed MkDocs with pip (not a package manager)

  • updated mkdocs.yaml to add:

theme:
   name: material
  • then:
mkdocs serve
  • result:
ERROR   -  Config value: 'theme'. Error: Unrecognised theme name: '{name_of_theme}'. The available installed themes are: mkdocs, readthedocs

According to @JerryC8080 :

Your are suggested to make mkdocs and material on the same way

Such as both installed by pip

Because mkdocs build and mkdocs serve command will load the same level directory to find theme

So try :

pip3 install mkdocs
pip3 install mkdocs-material

一些配置

导航栏

在 docs 下建立文件夹,文件夹名就是导航名。

文件夹中的文件按 文件名 字典序排列,显示的名称是 一级标题

In order to link a page to a section, create a new document with the name index.md in the respective folder, and add it to the beginning of your navigation section:

1
2
3
4
5
6
nav:
  - Section:
    - section/index.md 
    - Page 1: section/page-1.md
    ...
    - Page n: section/page-n.md