Build site with MkDocs
What is MkDocs?
Accroding to the description from the offical site of MkDocs:
MkDocs is a fast, simple and downright gorgeous static site generator that’s geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file. Start by reading the introductory tutorial, then check the User Guide for more information.
With MkDocs, you can generate a static site in a minute and deploy it on your server or github pages.
Installation
First, make sure that Python was installed on you PC and install MkDocs with follow command.
1 | pip install mkdocs |
Create a new project
1 | mkdocs new my-project |
mkdocs.yml
is the configuration file. The docs
folder contains your markdown source files.
1 | mkdocs serve |
You can preview the site at http://127.0.0.1:8000/
in your browser.
Deploying
Create a Github repository. clone to your local directory and add site/
to .gitignore
1 | mkdir docs |
Write your docs in the folder docs
. Then run the command:
1 | mkdocs gh-deploy --clean |
It will create a gh-pages
branch in your respository and deploy the static site on your github page. Set the default branch to built github pages.
You can access you site at https://{username}.github.io/{projectname}
.
Use MkDocs-Material Theme
1 | Install gtk3-runtime-3.xxx-ts-win64.exe at https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases |
Configure the sites in mkdocs.yml
refer to the official documents.
1 | site_name: Notebook |