采用Material主题
Documentation that simply works
Material for MkDocs is a powerful documentation framework on top of MkDocs, a static site generator for project documentation.
安装 mkdocs-material#
Getting started - Installation
$ pip install mkdocs-material
# or
$ pip3 install mkdocs-material
# or
$ python3 -m pip install mkdocs-material
设置主题为 material#
Getting started - Creating your site - Configuration
Minimal configuration:
在 mkdocs.yml 配置文件中,指定主题 material,替换默认的 mkdocs 主题:
Setup & Customization#
Advanced configuration:
Material for MkDocs comes with many configuration options. The Setup section explains in great detail how to configure and customize colors, fonts, icons and much more
- Site structure
- Appearance
- Content
- Optimization
Getting started - Customization
- Adding assets
- Extending the theme
- Theme development
MkDocs Material Preview#
MkDocs Material Preview - Visual Studio Marketplace: A VS Code extension that enhances the built-in Markdown preview to render Material for MkDocs and Zensical components that are not supported by the default Markdown renderer.
它通过附加插件来扩展 VS Code 内置的 Markdown 解析器--markdown-it,从而增强支持渲染/预览以下 Material 特性组件:
- Admonitions —
!!! type "title"(standard),??? type(collapsible),???+ type(collapsible, open) - Content Tabs —
=== "Tab Title"with CSS-only tab switching - Code Enhancements —
title="file.py",hl_lines="2 4-6",linenums="1"on fenced code blocks
它是预览 Material for MkDocs/Zensical 语法最高效的方式,无需任何配置步骤,只需打开预览界面即可使用。
The relevant commands in Command Pallete are as follows:
- Markdown: Toggle Preview View
- Markdown: Open Preview to the Side
- Markdown: Open Preview
- Markdown: Switch to Preview View
参考借鉴#
Stackoverflow - Questions tagged mkdocs-material
Migrating my blog from Jekyll Minimal Mistakes to Mkdocs Material @github
claassen.net - Blogging with mkdocs
使用 MkDocs 和 Material 主题搭建技术博客 @github
基于 Material for MkDocs 搭建静态网页 @github
把博客生成器从 Hugo 迁移到 Mkdocs @github
Mkdocs Material使用记录 - 详尽记录 @github
快来美化你的MKDocs吧 - material 配置