Skip to content

MkDocs Setup Information

Introduction

MkDocs is a static site generator that's geared towards project documentation. It is written in Python and is easy to configure and deploy.

Installation

To install MkDocs, use the following command:

pip install mkdocs

Creating a New Project

To create a new MkDocs project, run:

mkdocs new my-project
cd my-project

Running the Project

To start the live-reloading docs server, use:

mkdocs serve

You can then view the documentation at http://127.0.0.1:8000/.

Building the Documentation

To build the documentation, run:

mkdocs build

This will create a site directory with your static site.

Configuration

The configuration file mkdocs.yml is where you configure your MkDocs project. Here is an example configuration:

# filepath: myDocs/my-project/mkdocs.yml
site_name: My Documentation Project
theme:
  name: material
  custom_dir: docs/overrides

# above theme is added for customization of your docs (optional)

nav:
  - Home: index.md
  - React:
      - Snippets: react/snippets/example-snippet.md
      - Information: react/information/example-info.md
  - Bootstrap:
      - Snippets: bootstrap/snippets/example-snippet.md
      - Information: bootstrap/information/example-info.md
  - Tailwind:
      - Snippets: tailwind/snippets/example-snippet.md
      - Information: tailwind/information/example-info.md
  - Virtual Environment:
      - Snippets: virtual-environment/snippets/create-virtual-env.md
      - Information: virtual-environment/information/virtual-env-info.md
  - MkDocs:
      - Snippets: mkdocs/snippets/example-snippet.md
      - Information: mkdocs/information/example-info.md

plugins:
  - search
  - copy-button

extra:
  social:
    - icon: fontawesome/brands/github
      link: https://github.com/yourusername/yourrepo

Deployment

You can deploy your MkDocs site to GitHub Pages using:

mkdocs gh-deploy

For more detailed information, refer to the MkDocs documentation.