安装
pip install mkdocs
基本命令
命令 | 描述 |
---|---|
mkdocs new [dir-name] | 新建一个项目 |
mkdocs serve | 开启网页服务 |
mkdocs build | 创建静态网站 |
mkdocs help | 帮助文档 |
注意,new会在当前目录下建立项目文档,serve/build都要在项目目录下执行
配置信息
配置信息在工程目录下mkdocs.yml中修改,格式是字典格式
参数 | 描述 |
---|---|
site_name | 网页标签名 |
site_url | Set the canonical URL of the site. This will add a link tag with the canonical URL to the generated HTML header. |
repo_url | 将会添加github或者Bitbucket链接 |
repo_name | 同上 |
edit_uri | |
site_description | |
site_description | meta标签 |
site_author | meta标签 |
site_favicon | 设置ico,需要将ico文件放在docs/目录下 |
copyright | 设置版权信息 |
google_analytics | 设置谷歌站点分析工具 |
remote_branch | |
remote_name | |
pages | 设置路径 |
theme | 设置主题,readthedocs |
theme_dir | 设置主题路径 |
docs_dir | |
site_dir | |
extra_css | |
extra_javascript | |
extra_templates | |
extra | |
use_directory_urls | |
strict | |
dev_addr | |
markdown_extensions |
安装第三方主题
windmill主题
下载:
pip install mkdocs-windmill
在mkdocs.yml配置文件中配置主题:
theme: windmill
extra:
logo: logo的路径
version: 版本说明
article_nav_top: 默认为true,是否显示上方的Previous/Next 按钮
article_nav_bottom: 默认为true,是否显示下方的Previous/Next 按钮
history_buttons: 默认为true,是否显示历史记录