Documentation >> Python >> Tools >> MkDocs >> How to use mkdocs and where to find markdown cheatsheets

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.

Install, run

pip install mkdocs

cd /somedir

mkdocs new myproject

cd myproject

# to start the mkdocs site at http://localhost:8000
mkdocs serve

# or serve at specific IP & port
mkdocs serve -a x.x.x.x:8001

# or listen to all ip at specific port
mkdocs serve -a *:8001

Configure and customize your site

mkdocs.yml
settingg default value Example
site_name: Your Site Name` MkDocs site_name: Myfaqbase Docs
site_url:SiteUrl  null  
repo_url: YourRepoUrl null repo_url: https://github.com/example/repository/
repo_name: GitHub, Bitbucket or GitLab  
edit_uri   # Query string example
edit_uri: '?query=root/path/docs/'

# Hash fragment example
edit_uri: '#root/path/docs/'

# Query string example
edit_uri: root/path/docs/
site_description: YourDescription null  
site_author:    
copyright:    
google_analytics:   google_analytics: ['UA-36723568-3', 'mkdocs.org']
remote_branch:    
remote_name    
nav:  

nav:
    - 'Introduction': 'index.md'
    - 'User Guide': 'user-guide.md'
    - 'About': 'about.md'

nav:
    - Home: index.md
    - User Guide: user-guide.md
    - Bug Tracker: https://example.com/

 

theme:
    name: themename
    custom_dir: theme_customizationdir
    static_templates:
        - staticpage1.html
        - staticpage2.html
    include_sidebar: [true|false]
    highlightjs: [true|false]
    hljs_languages:
        - lang1
        - lang2
    shortcuts:
        help: 191    # ?
        next: 78     # n
        previous: 80 # p
        search: 83   # s
    docs_dir:
    site_dir:
    extra_css:
    extra_javascript:
    extra_templates:
    extra:
        key1: value1
        key2: value2

 

 

theme:
    name: mkdocs
    custom_dir: my_theme_customizations/
    static_templates:
        - sitemap.html
    include_sidebar: false

theme:
    name: mkdocs
    highlightjs: true
    hljs_languages:
        - yaml
        - rust

     

 

markdown cheatsheets