Skip to content

mkdocs

Install mkdocs

pip install mkdocs-material

Allow soft wrap lines in code block

<style>
  code {
    white-space : pre-wrap !important;
    word-break: break-word;
  }
</style>

Setup

  • Install python pip
apt install python3-pip
  • Install mkdocs
pip install mkdocs-material
  • Create folder for mkdocs
mkdir -p /var/www/html/mkdocs/
  • Create mkdocs project
cd /var/www/html/mkdocs/
mkdocs new .

-Configuration

/var/www/html/mkdocs/mkdocs.yml

site_name: My Docs
theme:
  name: material
plugins:
  - search
nav:
  - Home: index.md
  - Guides:
    - guides/getting-started.md    
  - setup.md
  - about.md
  • Build
mkdocs build
  • Change index page
/var/www/html/mkdocs/docs/index.md

Hello world
  • Serve with ngninx
/var/www/html/mkdocs/site/index.html

see ngginx configuration