--Environment --Windows10 Pro version 1909 - Python 3.8.5 -Click here for Python installation record - pip 20.2.3
Reference: Document creation with MkDocs --Qiita
#install
> pip install mkdocs
Collecting mkdocs
Downloading mkdocs-1.1.2-py3-none-any.whl (6.4 MB)
|████████████████████████████████| 6.4 MB 726 kB/s
# ...abridgement...
Successfully installed Jinja2-2.11.2 Markdown-3.2.2 MarkupSafe-1.1.1 PyYAML-5.3.1 click-7.1.2 joblib-0.17.0 livereload-2.6.3 lunr-0.5.8 mkdocs-1.1.2 nltk-3.5 regex-2020.9.27 tornado-6.0.4 tqdm-4.50.0
#Check the version
> mkdocs -V
mkdocs, version 1.1.2 from c:\path\to\venv\lib\site-packages\mkdocs (Python 3.8)
The mkdocs.yml
created when you create a project becomes the configuration file
#When you create a project with the project name "docs"
> mkdocs new docs
INFO - Creating project directory: docs
INFO - Writing config file: docs\mkdocs.yml
INFO - Writing initial docs: docs\docs\index.md
#A directory with the project name is created
> ls -la | grep docs
drwxr-xr-x 1 m-ukigaya 1049089 0 October 5 12:55 docs/
# index.md and mkdocs.yml is created
> find docs/ -type f
docs/docs/index.md
docs/mkdocs.yml
#Go to your project directory
> cd docs
#Build
> mkdocs build
INFO - Cleaning site directory
INFO - Building documentation to directory: C:\path\to\docs\site
INFO - Documentation built in 0.11 seconds
#Start the server
> mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
INFO - Documentation built in 0.12 seconds
[I 201005 13:00:32 server:335] Serving on http://127.0.0.1:8000
INFO - Serving on http://127.0.0.1:8000
[I 201005 13:00:32 handlers:62] Start watching changes
INFO - Start watching changes
[I 201005 13:00:32 handlers:64] Start detecting changes
INFO - Start detecting changes
[I 201005 13:00:41 handlers:135] Browser Connected: http://127.0.0.1:8000/
INFO - Browser Connected: http://127.0.0.1:8000/
#Ctrl when you want to stop the server+ C
Note: Start the server with mkdocs serve
instead of mkdocs server
. I don't need "r".
> mkdocs server
Usage: mkdocs [OPTIONS] COMMAND [ARGS]...
Try 'mkdocs -h' for help.
Error: No such command 'server'.
When [http://127.0.0.1:8000/] output by mkdocs serve
is displayed on the browser, it looks like this
--Reference: Let's start mkdocs that can easily create documents --Qiita
Install a theme that sets the appearance.
This time, I will try using material
introduced on other sites.
I don't care if Requirement already satisfied: ...
is displayed during installation because it's like "I'm already installed".
> pip install mkdocs-material
Collecting mkdocs-material
Downloading mkdocs_material-6.0.2-py2.py3-none-any.whl (3.9 MB)
|████████████████████████████████| 3.9 MB 86 kB/s
# ...abridgement...
Requirement already satisfied: regex in c:\path\to\venv\lib\site-packages (from nltk>=3.2.5; python_version > "2.7" and extra == "languages"->lunr[languages]==0.5.8->mkdocs>=1.1->mkdocs-material) (2020.9.27)
Installing collected packages: Pygments, pymdown-extensions, mkdocs-material-extensions, mkdocs-material
Successfully installed Pygments-2.7.1 mkdocs-material-6.0.2 mkdocs-material-extensions-1.0.1 pymdown-extensions-8.0.1
> pip list
Package Version
-------------------------- ---------
...
mkdocs 1.1.2
mkdocs-material 6.0.2
mkdocs-material-extensions 1.0.1
...
Pygments 2.7.1
# Project information
site_name: 'Site name'
# Documentation and theme
docs_dir: 'docs'
theme: 'material'
# Extensions
markdown_extensions:
- admonition
- toc:
permalink: '#'
mkdocs serve
Recommended Posts