145 Commits
v0.0.1 ... main

Author SHA1 Message Date
Michael Currin
e568b53c0b ci: rename branch 2021-07-28 13:06:39 +02:00
Michael Currin
5dd48b2724 Update README.md 2021-07-20 22:24:04 +02:00
Michael Currin
7b27555c9c Update README.md 2021-06-19 22:03:56 +02:00
Michael Currin
f124cfed0c Update README.md 2021-06-19 22:02:18 +02:00
Michael Currin
ad7a922caf docs: update deploy.md, installation.md and usage.md 2021-06-09 10:59:32 +02:00
Michael Currin
3b42b265ed build: update Makefile 2021-06-09 10:59:27 +02:00
Michael Currin
dae5dbde87 fix(deps): choose working version of mkdocs 2021-06-09 10:59:23 +02:00
Michael Currin
2018fa399b docs: update deploy.md 2021-06-08 18:25:31 +02:00
Michael Currin
0484dbbb36 docs: update setup-project.md 2021-06-08 18:16:47 +02:00
Michael Currin
898c72051c build: add missing site_url field 2021-06-08 18:15:53 +02:00
Michael Currin
e5bcc9ac5f ci: update docs.yml 2021-06-08 18:09:58 +02:00
Michael Currin
158e6dc938 ci: rename workflow 2021-06-08 18:01:22 +02:00
Michael Currin
828bf66208 feat: rename setup to set up 2021-06-08 18:00:21 +02:00
Michael Currin
16e004a200 fix: set edit_uri with docs subdir 2021-06-08 17:58:44 +02:00
Michael Currin
acd0ac400d chore: update .gitignore 2021-06-08 17:03:58 +02:00
Michael Currin
1bcc5ce191 build: update Makefile 2021-06-08 17:02:37 +02:00
Michael Currin
4fb05cb607 chore: update settings.json 2021-06-08 17:02:28 +02:00
Michael Currin
a0e179cf37 ci: update docs.yml 2021-06-08 17:02:22 +02:00
Michael Currin
aef52ecef8 Update about-mkdocs.md 2021-06-08 16:58:26 +02:00
Michael Currin
c847fcad63 Update mkdocs.yml 2021-06-08 16:57:34 +02:00
Michael Currin
12e2d22aeb Update LICENSE 2021-06-08 16:49:47 +02:00
Michael Currin
8781bdacc6 Update README.md 2021-06-08 16:49:26 +02:00
Michael Currin
1a7fb2188e Update index.md 2021-04-04 21:28:35 +02:00
Michael Currin
bab097381d Update README.md 2021-04-04 21:26:33 +02:00
Michael Currin
a29dcb851f Update setup-project.md 2021-04-04 21:25:56 +02:00
Michael Currin
f78e2a23b9 Update mkdocs.yml 2021-04-04 21:24:45 +02:00
Michael Currin
a90d16525f Update README.md 2021-02-15 23:23:27 +02:00
Michael Currin
4cb7066ac6 Update README.md 2021-02-15 23:20:13 +02:00
Michael Currin
b0ce48a07c Update README.md 2021-02-15 23:19:47 +02:00
Michael Currin
e7f49d04b7 Update docs.yml 2021-02-15 23:18:15 +02:00
Michael Currin
2c0468d4bc Update README.md 2021-02-15 23:15:50 +02:00
Michael Currin
3de9789c2a Update LICENSE 2021-01-14 16:14:01 +02:00
Michael Currin
17919978b1 Update README.md 2021-01-14 16:13:38 +02:00
Michael Currin
8a1ad62921 Update setup-project.md 2020-12-18 12:27:09 +02:00
Michael Currin
48218d64da Update setup-project.md 2020-12-18 12:24:27 +02:00
Michael Currin
6f2b3c818e Update installation.md 2020-12-18 12:22:56 +02:00
Michael Currin
e49c7ae2b3 Update deploy.md 2020-12-18 12:18:44 +02:00
Michael Currin
619a224358 Update docs.yml 2020-12-18 12:08:47 +02:00
Michael Currin
adf4d392f8 Update README.md 2020-12-18 12:07:09 +02:00
Michael Currin
dacf3464e2 Update setup-project.md 2020-10-17 19:47:05 +02:00
Michael Currin
566de0e514 docs: Update docs 2020-10-17 17:33:03 +02:00
Michael Currin
8bd56b6906 docs: Update about-mkdocs.md 2020-10-17 17:30:12 +02:00
Michael Currin
2b289a59b0 chore: Update requirements.txt 2020-10-17 17:29:41 +02:00
Michael Currin
3f0006ac82 docs: Update README.md 2020-10-17 17:25:17 +02:00
Michael Currin
76e04dde8e ci: Fix path of cache 2020-10-17 17:24:30 +02:00
Michael Currin
8601582a74 ci: Add cache step 2020-10-17 17:21:54 +02:00
Michael Currin
f22c1fe04d docs: Update deploy.md 2020-10-17 17:17:05 +02:00
Michael Currin
e577bb912b docs: Update instructions 2020-10-17 17:10:04 +02:00
Michael Currin
887d08bc3c ci: Update docs.yml 2020-10-17 17:09:57 +02:00
Michael Currin
473580b7d6 docs: Update README.md 2020-10-17 17:00:49 +02:00
Michael Currin
99fb0757c7 chore: Move to docs directory 2020-10-17 17:00:45 +02:00
Michael Currin
a028e5c228 docs: Update README.md 2020-10-17 16:55:46 +02:00
Michael Currin
49d6ee84a7 docs: Update docs 2020-10-17 16:54:30 +02:00
Michael Currin
f21ac0fe3c chore: Delete tasks.json 2020-10-17 16:54:23 +02:00
Michael Currin
3b5f31d73d ci: Update and use deploy target 2020-10-17 16:48:56 +02:00
Michael Currin
3a743ae48f docs: Update deploy.md 2020-10-17 16:45:45 +02:00
Michael Currin
fdbbb73cd6 chore: Rename main.yml to docs.yml 2020-10-17 16:45:20 +02:00
Michael Currin
953967dda8 ci: Update main.yml 2020-10-17 16:45:02 +02:00
Michael Currin
35ce122bd8 ci: Remove use of action 2020-10-17 16:44:00 +02:00
Michael Currin
89fbc16c26 chore: Update Makefile 2020-10-17 16:34:24 +02:00
Michael Currin
e7800bc936 docs: Update usage.md 2020-10-17 16:34:21 +02:00
Michael Currin
54be3ff415 docs: Update deploy.md 2020-10-17 16:34:18 +02:00
Michael Currin
b48560c99d docs: Update README.md 2020-10-17 16:27:29 +02:00
Michael Currin
d14aca853a chore: Update Makefile 2020-10-17 16:24:02 +02:00
Michael Currin
11c1377a9f chore: Update Makefile 2020-10-17 16:23:41 +02:00
Michael Currin
5e8b217c8d docs: Update docs 2020-10-17 16:23:20 +02:00
Michael Currin
b842ce958e docs: Rename Github to GitHub 2020-10-17 15:01:58 +02:00
Michael Currin
787dc334a1 ci: Update main.yml 2020-10-17 15:00:21 +02:00
Michael Currin
286e8c6f0d ci: Upgrade action version 2020-10-16 17:58:07 +02:00
Michael Currin
1decccd809 Update README.md 2020-10-16 17:57:15 +02:00
Michael Currin
6bef7960f0 Update README.md 2020-10-16 17:55:24 +02:00
Michael Currin
645a052e22 ci: Update main.yml 2020-10-15 11:51:20 +02:00
Michael Currin
da67a34443 chore: Update mkdocs.yml 2020-10-15 11:50:48 +02:00
Michael Currin
4a9f27222a ci: Update main.yml 2020-10-15 11:05:59 +02:00
Michael Currin
8feabd1a43 chore: Update mkdocs.yml 2020-10-15 11:00:13 +02:00
Michael Currin
ae37b3874d docs: Update advanced.md 2020-10-15 10:54:27 +02:00
Michael Currin
3630bab42c docs: Update setup-project.md 2020-10-15 10:54:23 +02:00
Michael Currin
4726a67ef3 chore: Update mkdocs.yml 2020-10-15 10:52:13 +02:00
Michael Currin
c25398473f docs: Update pages 2020-10-15 10:43:47 +02:00
Michael Currin
b27fe05ebe chore: Create Makefile 2020-10-15 10:43:20 +02:00
Michael Currin
01e7c407b0 style: Dedent 2020-10-15 10:43:17 +02:00
Michael Currin
8434d546bb chore: Update LICENSE 2020-10-15 10:42:52 +02:00
Michael Currin
4753edcbe9 Update README.md 2020-10-14 23:15:02 +02:00
Michael Currin
7e69b48377 Update mkdocs.yml 2020-10-14 23:12:27 +02:00
Michael Currin
6a5cfe2377 Update main.yml 2020-10-14 23:11:56 +02:00
Michael Currin
7177e48983 Update README.md 2020-10-14 23:04:14 +02:00
Michael Currin
989e13de5e Update mkdocs.yml 2020-10-14 23:01:19 +02:00
Michael Currin
4c169b9981 Update installation.md 2020-10-14 22:59:32 +02:00
Michael Currin
81e9147b2b Update README.md 2020-10-14 22:55:56 +02:00
Michael Currin
6f7122d7cd Update README.md 2020-10-14 22:47:36 +02:00
Michael Currin
f537e68f5f Update README.md 2020-10-14 22:46:38 +02:00
michaelcurrin
49b3a80578 Update README.md 2020-09-10 17:35:30 +02:00
michaelcurrin
dbc5a5a15e Update mkdocs.yml 2020-09-10 17:33:50 +02:00
michaelcurrin
bcd5d97980 Update README.md 2020-09-10 17:31:20 +02:00
michaelcurrin
bf0b822e71 Update README.md 2020-09-10 17:24:39 +02:00
michaelcurrin
1743e1c99f Update README.md 2020-09-10 17:22:18 +02:00
michaelcurrin
a4858ef9ef Update README.md 2020-09-10 17:21:33 +02:00
michaelcurrin
24fcac8f5b Update index.md 2020-09-10 17:20:30 +02:00
michaelcurrin
aa732678ba Update README.md 2020-09-10 17:20:19 +02:00
michaelcurrin
66f0fa8cd7 Update README.md 2020-09-10 17:19:15 +02:00
michaelcurrin
eebbe99358 Update README.md 2020-09-10 17:18:51 +02:00
michaelcurrin
0f4f91bbc8 Update README.md 2020-09-10 17:15:44 +02:00
michaelcurrin
bbdbd30f69 Update index.md 2020-06-16 20:50:36 +02:00
michaelcurrin
09f8bc898f Update deploy.md 2020-06-16 20:49:42 +02:00
michaelcurrin
8aa74eb6b0 Update README.md 2020-06-16 19:47:33 +02:00
michaelcurrin
9571f1ad46 Update and rename about_mkdocs.md to about-mkdocs.md 2020-06-16 19:46:59 +02:00
michaelcurrin
91582e3392 Update mkdocs.yml 2020-06-16 19:46:35 +02:00
michaelcurrin
b4f9479472 Rename setup_project.md to setup-project.md 2020-06-16 19:45:22 +02:00
michaelcurrin
7b0ffe8c9d chore: Update main.yml 2020-06-16 19:44:23 +02:00
michaelcurrin
a8d346de5d Update setup_project.md 2020-06-16 19:38:50 +02:00
michaelcurrin
aa4bf1088c Update installation.md 2020-06-16 19:34:14 +02:00
michaelcurrin
84b65458a2 chore: Add workflow 2020-06-16 19:28:11 +02:00
michaelcurrin
f4f6a6861d Create main.yml 2020-06-16 19:25:14 +02:00
michaelcurrin
735ab35a26 Update setup_project.md 2020-06-16 19:21:26 +02:00
michaelcurrin
65d7c7343b Update README.md 2020-06-16 18:23:36 +02:00
Michael Currin
0ae70d2fcd feat: Update pages 2020-06-02 22:37:33 +02:00
Michael Currin
7b729ba759 docs: Update README.md 2020-06-02 22:37:29 +02:00
Michael Currin
e0d9117274 chore: Create requirements.txt 2020-06-02 22:37:22 +02:00
Michael Currin
928f697e0c feat: Update pages 2020-06-02 22:19:04 +02:00
Michael Currin
f45d546ccf docs: Update README.md 2020-06-02 22:18:57 +02:00
michaelcurrin
3400d5c4bb Update index.md 2020-06-01 10:14:20 +02:00
michaelcurrin
95f5e64589 Update README.md 2020-06-01 10:10:12 +02:00
michaelcurrin
1b92ee3dde Update README.md 2020-06-01 10:08:48 +02:00
michaelcurrin
d2521f69a4 Update setup_project.md 2020-05-20 12:53:20 +02:00
michaelcurrin
e14b88702e Update tldr.md 2020-05-19 13:46:47 +02:00
michaelcurrin
10bb3fabcc Update setup_project.md 2020-05-19 13:41:36 +02:00
michaelcurrin
ddb2e02ac0 Update index.md 2020-05-19 13:38:55 +02:00
michaelcurrin
9a4668db47 Update README.md 2020-05-19 13:33:01 +02:00
michaelcurrin
375db30200 docs: Create sample.png 2020-05-19 13:20:56 +02:00
Michael Currin
15e528c07f feat: Add badges 2020-05-03 11:42:56 +02:00
Michael Currin
b61b9d1a70 feat: Add content 2020-05-03 11:32:14 +02:00
Michael Currin
2d5113a961 chore: Move files to tutorial 2020-05-03 11:31:57 +02:00
Michael Currin
2b4544320b feat: Restructure and add content 2020-05-03 11:17:55 +02:00
Michael Currin
52a8f7862a feat: Update pages 2020-05-03 10:01:04 +02:00
Michael Currin
bdcd8f367c feat: Update tutorial.md 2020-05-03 09:54:10 +02:00
michaelcurrin
cfb5853123 Update index.md 2020-05-03 09:24:15 +02:00
michaelcurrin
d59ed88866 Update tutorial.md 2020-05-03 09:17:27 +02:00
michaelcurrin
7e5650e241 Update tutorial.md 2020-05-03 09:13:03 +02:00
michaelcurrin
dc05d52b62 Update index.md 2020-05-02 23:56:24 +02:00
Michael Currin
3e735f3893 docs: Update description 2020-05-02 23:26:35 +02:00
michaelcurrin
7a07748602 Update setup_and_run.md 2020-05-02 23:24:48 +02:00
Michael Currin
06171073a3 docs: Update description 2020-05-02 23:18:32 +02:00
Michael Currin
0b9cc10056 feat: Update description 2020-05-02 23:18:22 +02:00
Michael Currin
29f21df22c feat: Update pages 2020-05-02 23:17:36 +02:00
Michael Currin
4f2c416522 chore: Create VS Code configs 2020-05-02 22:39:11 +02:00
22 changed files with 688 additions and 123 deletions

36
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Deploy Docs
on:
push:
branches:
- main
jobs:
build-deploy:
name: Build and deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Set up Python 3 ⚙️ 🐍
uses: actions/setup-python@v2
- name: Cache dependencies 💾
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies 🔧
working-directory: docs
run: make install
- name: Build and deploy to GitHub Pages 🏗️ 🚀
working-directory: docs
run: make deploy

4
.gitignore vendored
View File

@@ -1,3 +1,3 @@
site/
venv
site/

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"python.pythonPath": "venv/bin/python"
}

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 michaelcurrin
Copyright (c) 2020 - 2021 MichaelCurrin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

116
README.md
View File

@@ -1,2 +1,116 @@
# MkDocs Quickstart
> A brief guide for setting up a MkDocs docs site on Github Pages
> Starter template for a MkDocs docs site on GH Pages - including CI
[![CI status](https://github.com/MichaelCurrin/mkdocs-quickstart/workflows/Deploy%20Docs/badge.svg)](https://github.com/MichaelCurrin/mkdocs-quickstart/actions)
[![GitHub tag](https://img.shields.io/github/tag/MichaelCurrin/mkdocs-quickstart?include_prereleases=&sort=semver)](https://github.com/MichaelCurrin/mkdocs-quickstart/releases/)
[![License](https://img.shields.io/badge/License-MIT-blue)](#license)
[![Made with Python](https://img.shields.io/badge/Python->%3D3.6-blue?logo=python&logoColor=white)](https://python.org)
[![Made with MkDocs](https://img.shields.io/badge/mkdocs-1-blue)](https://www.mkdocs.org/)
[![CI - GH Actions](https://img.shields.io/badge/CI-GH_Actions-blue?logo=github-actions&logoColor=white)](https://github.com/features/actions)
A template, live demo and tutorial for how to set up a MkDocs docs site on GH Pages. Using GitHub Actions to automated deploys.
MkDocs is a Python package when turns your docs directory and YAML config into a static website. No Python coding needed. Just Markdown and some light configuration including a theme choice and menu.
<!-- TODO When creating a new project copied from this template, you can delete this README.md and start over -->
## Purpose
This project provides low-code content-focused way to set up and host a markdown-based documentation site, with a professional look and themes. Built with MkDocs - a Python package which is a static site generator specializing in documentation.
A GitHub Actions workflow is provided with this template so you can easily deploy to GitHub Pages too.
## Preview
<div align="center">
[![Sample screenshot](/sample.png)](https://michaelcurrin.github.io/mkdocs-quickstart/ "Sample screenshot")
</div>
This template project is configured to use the _Read the Docs_ theme, as shown above.
Thus looks like the the [Read The Docs][] site, but without having to have to overhead of using Sphinx.
[Read The Docs]: https://docs.readthedocs.io
This Read the Docs theme for MkDocs comes with MkDocs already, so you don't need to add to your dependencies. But you can switch to the MkDocs default or install and configure another theme.
You can switch to the default theme or install some others, based on the instructions in this template project.
## How to use this project
<div align="center">
[![GH Pages](https://img.shields.io/badge/View_site-MkDocs_Quickstart-blue?style=for-the-badge)](https://michaelcurrin.github.io/mkdocs-quickstart/)
[![Use this template](https://img.shields.io/badge/Generate-Use_this_template-2ea44f?style=for-the-badge)](https://github.com/MichaelCurrin/mkdocs-quickstart/generate)
</div>
## Features
- A **markdown-based** docs site which is easy to edit - see the content in the [docs](/docs/docs/) directory.
- Easy to **configure** - see the short [mkdocs.yml](/docs/mkdocs.yml) file.
- Use the configured theme or switch to another - no need to write HTML and CSS yourself.
- Each theme comes with a navbar and you write YAML - Jekyll themes on GH Pages need you to write your own HTML often and each theme handles navbar its own way (sometimes not at all).
- Uses a deploy pipeline on GH Actions to deploy a GH Pages site - the action actually runs GH Pages deploy command.
- The static site output is **SEO-friendly**.
- Built on Python but you don't need to write any Python code.
### View live demo site
This project has a site deployed to GitHub Pages.
Purposes of the site:
- A live demo.
- Content for a beginner-friendly tutorial on how to setup, run, deploy and customize a MkDocs project like this one.
### Use this template
This repo also doubles as a template to create a new project from. Click the button at the top.
Change the content and theme to suit your needs, based on the tutorial site or the MkDocs site.
To isolate the MkDocs flow from the rest of your code, you can put the configs and the `docs` folder of content inside the `docs` directory. That means you end up having `docs/docs`, which is okay. Just make sure you select the `/docs` directory when setting up GH Pages.
## About MkDocs
### Resources
- Homepage: [mkdocs.org](http://www.mkdocs.org/)
- Repo: [![mkdocs - mkdocs](https://img.shields.io/static/v1?label=mkdocs&message=mkdocs&color=blue&logo=github)](https://github.com/mkdocs/mkdocs) [![stars - mkdocs](https://img.shields.io/github/stars/mkdocs/mkdocs?style=social)](https://github.com/mkdocs/mkdocs)
- PyPI package: [mkdocs](https://pypi.org/project/mkdocs/)
### Why MkDocs?
If you're new to MkDocs, look at the tutorial added on this project's site, otherwise go to the MkDocs homepage for documentation.
This project provides a way to write your docs in markdown and build a professional-looking docs site on top of it, without having to write HTML or CSS code and using a selection of themes. While MkDocs CLI has functionality to deploy from a local command-line, this project makes deploying effortless by using GitHub Actions to build and deploy the site to a `gh-pages` branch and GitHub Pages to serve the site.
Compared with Jekyll and Docsify, I found the MkDocs code is much lighter to set up and changing themes is much easier than Jekyll. Also you get the benefits SEO which Docsify doesn't have. And it includes a search bar using JS.
## Contributing
Submit an issue.
Or submit a code change:
1. Fork this project.
2. Set up the project locally - follow the instructions on the live tutorial or in the [TL;DR](/docs/docs/tutorial/tldr.md) page of the local docs.
3. Make any changes you want. Be sure to keep a copy of the original license in the repo.
- e.g. `cp LICENSE LICENSE-source`
4. Create a Pull Request.
## License
Released under [MIT](/LICENSE) by [@MichaelCurrin](https://github.com/MichaelCurrin).

29
docs/Makefile Normal file
View File

@@ -0,0 +1,29 @@
.PHONY: docs
default: install
all: install build
h help:
@grep '^[a-z]' Makefile
install:
pip install pip --upgrade
pip install -r requirements.txt
upgrade:
pip install pip --upgrade
pip install -r requirements.txt --upgrade
s serve:
mkdocs serve --strict
b build:
mkdocs build --strict
d deploy:
mkdocs gh-deploy --strict --force

View File

@@ -1,31 +0,0 @@
# Deploy
> How to deploy a MkDocs site
See [Deploying Your Docs](https://www.mkdocs.org/user-guide/deploying-your-docs/) on the Mkdocs site for more details.
## Github Pages
_Note this is for a Project Page and not Organization and User Pages._
How to deploy to Github Pages.
Run this to build to `site` directory, push to `gh-pages` branch and enable Github Pages (if it was not yet enabled). The default option is to clean the site directory first.
```sh
mkdocs gh-deploy
```
Then go to your repo on Github, see the *environment* tab and click _View deployment_.
e.g.
- [michaelcurrin.github.io/mkdocs-quickstart/](https://michaelcurrin.github.io/mkdocs-quickstart/)
See deploy options:
```sh
mkdocs gh-deploy --help
```

41
docs/docs/about-mkdocs.md Normal file
View File

@@ -0,0 +1,41 @@
# About MkDocs
## What is MkDocs?
The description on the MkDocs site is:
> Project documentation with Markdown.
MkDocs is a Python tool that generates a static site based on content written in Markdown.
If you are new to markdown, see the [Getting Started](https://www.markdownguide.org/getting-started/) page on the Markdown Guide website.
## Resources
- [mkdocs.org](https://www.mkdocs.org) homepage
- [mkdocs/mkdocs ![Repo stars](https://img.shields.io/github/stars/mkdocs/mkdocs?style=social)](https://github.com/mkdocs/mkdocs)
- [MkDocs Wiki](https://github.com/mkdocs/mkdocs/wiki) - covering themes, plugins, recipes and more.
- [Release notes](https://www.mkdocs.org/about/release-notes/) for MkDocs.
## Reasons to use MkDocs
- Create an elegant, modern docs site for your project.
- Create a static site and serve from GitHub Pages easily.
- Low-code solution
- No need to write HTML or learn templating syntax needed
- Use your existing markdown files as content.
- Configure with a simple YAML file.
- Customizable.
- Add custom HTML if you want.
- Plugins available.
- Flexible theme choices.
- Includes search by default.
- Broken links to files (including from your navbar) will be detected at build time and shown as warnings.
## Do I need to know Python?
MkDocs is built in Python (like Sphinx), but you don't have to write Python code. If you set up a [Deploy](deploy) flow right, you don't even have to set it up locally, though then you can't preview.

26
docs/docs/index.md Normal file
View File

@@ -0,0 +1,26 @@
# MkDocs Quickstart
> Started template for a MkDocs docs site on GH Pages - including CI
[![Repo stars](https://img.shields.io/github/stars/MichaelCurrin/mkdocs-quickstart?style=social)](https://github.com/MichaelCurrin/mkdocs-quickstart)
Use the MkDocs (_make docs_) tool to create build a docs site around markdown docs.
Follow the tutorial to add an existing project or create a project from scratch. The result will look like this project.
## Features
> How to use this project
- **Follow the tutorial instructions**
- Install and configure a new or existing project.
- Run it locally.
- Deploy it.
- **Add a copy of this project to your repos**
- [![Use this template](https://img.shields.io/badge/Use_this_template-2ea44f?logo=github)](https://github.com/MichaelCurrin/mkdocs-quickstart/generate)
- **View the live demo**
- This site is hosted on GitHub Pages. See if you like it. Other themes are available - see the tutorial.
The aim here is not be complete or explain all concepts. It is to provide a reference for common steps and choices needed when setting up a docs site, but still at a beginner-friendly level.
This guide is based on the [mkdocs.org](https://www.mkdocs.org/) tutorial.

View File

@@ -0,0 +1,53 @@
# Advanced
> Beyond the basic configuration and content
Once you've got the [Set up Project](setup-project.md) section, you can customize further using this guide. Or skip this and go to [Usage](usage.md).
## Navbar nesting
You can add an additional level to your navbar like this:
```yaml
nav:
- Home: index.md
- About: about.md
- Foo:
- Overview: foo/index.md
- Bar: foo/bar.md
```
The value can either be a string (as in the first case) or a map (as in the last case). This seems to be a YAML limitation but see also [issue #1139](https://github.com/mkdocs/mkdocs/issues/1139).
## Add config options
See [Configuration](https://www.mkdocs.org/user-guide/configuration/) page on MkDocs site for options.
## Separate docs directory approach
You can also structure your project to have the set up above nested inside a `docs` directory. This is useful you have a few other directories and you want to keep the project root clean.
- `docs/`
- `docs/`
- `index.md`
- `theme/`
- `main.html`
- `nav.html`
- `toc.html`
- `mkdocs.yml`
An example of this is the [Poetry](https://github.com/python-poetry/poetry/tree/master/docs) repo. That project is also how I got into MkDocs in the first place.
## Embedding
To embed a gist, just copy and paste the embed script URL which is provided on a gist.
e.g.
```html
<script src="https://gist.github.com/MichaelCurrin/57caae30bd7b0991098e9804a9494c23.js"></script>
```

View File

@@ -0,0 +1,59 @@
# Deploy
> Build and deploy to a remote public site
See [Deploying Your Docs](https://www.mkdocs.org/user-guide/deploying-your-docs/) on the Mkdocs site for more details.
## GitHub Pages
> How to deploy your docs site to GitHub Pages.
Follow one of the approaches below:
- [Run deploy command](#run-deploy-command) - Run a MkDocs CLI command locally to deploy.
- [Deploy with GitHub Actions](#deploy-with-github-actions) - Use the project's CI workflow in the cloud to build and deploy to GH Pages on commits pushed to master.
Then go to your repo's _Settings_ and _Pages_ then enable _GitHub Pages_ on the `gh-pages` branch's root.
_Note this is for a Project Page on a subpath, you will have to make adjustments to the command below if you want an Organization or User Page on the root path._
### Run deploy command
> Run a MkDocs CLI command locally to deploy
MkDocs needs to know where to publish commits on GitHub - so make sure you are working with a repo that you cloned, or that you initialize the local repo and add a `remote` repo.
Run this command locally:
```sh
$ make d
```
That will use `Makefile` to run the following:
```sh
$ mkdocs gh-deploy --strict --force
```
That will do the following:
1. Clean and build to `site` directory.
2. Force push to `gh-pages` branch, overwriting any changes which were pushed from another build.
Then go to your repo on GitHub, look at the *Environment* tab.
When it is done building, click _View deployment_ to see your site.
e.g. [michaelcurrin.github.io/mkdocs-quickstart/](https://michaelcurrin.github.io/mkdocs-quickstart/)
See deploy options in the help:
```sh
$ mkdocs gh-deploy --help
```
### Deploy with GitHub Actions
> Set up continuous deployment config to enable deploys on a change to files on GitHub
When you make changes to your docs config or the docs directory, especially editing on GitHub directly, it's often useful to have the docs site build and deploy automatically in a remote environment. This is provided for free by GitHub.
See the [docs.yml](https://github.com/MichaelCurrin/mkdocs-quickstart/blob/master/.github/workflows/docs.yml) workflow provided with this project. You don't have to change anything there. The token will be generated for you by GitHub Actions.

View File

@@ -0,0 +1,74 @@
# Installation
> How to install MkDocs locally.
## Requirements
- [Python 3](https://www.python.org/)
- [Make](https://www.gnu.org/software/make/) - standard on macOS and Linux but can be installed on Windows too.
## Install system dependencies
<script src="https://gist.github.com/MichaelCurrin/57caae30bd7b0991098e9804a9494c23.js"></script>
## Set up a new repo
Follow the Tutorial page to set up a project from scratch.
Or click this create your own copy of the repo.
[![Use this template](https://img.shields.io/badge/Use_this_template-2ea44f?style=for-the-badge&logo=github)](https://github.com/MichaelCurrin/mkdocs-quickstart/generate)
Then clone your repo.
e.g.
```sh
$ git clone git@github.com:MichaelCurrin/mkdocs-quickstart.git
$ cd mkdocs-quickstart
```
## Install project dependencies
> Install MkDocs locally
For more info, see the [Installation](https://www.mkdocs.org/#installation) page on the MkDocs site.
### Install in a virtual environment
Create a virtual environment at the project root - this is used to isolate project packages from the global packages.
```sh
$ python3 -m venv venv
```
Activate the environment.
```sh
$ source venv/bin/activate
```
Install `mkdocs` - this is covered in the project requirements file.
```sh
$ cd docs
$ make install
```
Note - `mkdocs` 1.2 causes a break on force pushes, so this is excluded in the requirements. See issue [#2447](https://github.com/mkdocs/mkdocs/issues/2447).
### Install globally
If you prefer to install MkDocs once and reuse it across projects, then you can install it globally instead.
MkDocs is available using package managers like `apt-get`, `homebrew` and `yum`.
Or you can install like this:
```sh
$ python3 -m pip install mkdocs
```
If you get prompted for `sudo` use, then cancel and run again with `-U` flag for user-level install.

View File

@@ -0,0 +1,150 @@
# Set up project
> How to create a MkDocs site from scratch
This is a summary of the tutorial on [mkdocs.org](https://www.mkdocs.org/).
## How to use this guide
Use one of the approaches below:
- Create a quickstart project with the `new` command covered in [Create a starter site](#create-a-starter-site).
- Follow the extended guide to create a [Set up up docs site](#setup-a-docs-site) by hand.
### Basic structure
This is the simplest MkDocs site you can make:
- `docs/`
- `index.md` - Homepage in the `docs` directory (by default).
- `mkdocs.yml`
- Config at the root - control appearance and navigation of your site.
- See this project's [docs/mkdocs.yml](https://github.com/MichaelCurrin/mkdocs-quickstart/blob/master/docs/mkdocs.yml) file on GitHub.
Notes on fields for the config:
- `site_name` - title of your site.
- `site_description` - used as a description for SEO and you could use it somewhere in your template.
- `site_url` - now a _required_ field when running a deploy. Include the subpath on the domain. If your site is not ready to be hosted, set this field to an empty string.
- `repo_url` - for _Edit on GitHub_ button. See [docs](https://www.mkdocs.org/user-guide/configuration/#repo_url).
- `edit_uri` - defaults to `edit/master/docs/`, which includes `docs` directory of markdown files inside your repo root. But, if the site's root is in an outer `docs` directory, then you need to _also_ add that, so paths do not break. e.g. `edit/master/docs/docs`. See [docs](https://www.mkdocs.org/user-guide/configuration/#edit_uri)
### Requirements file
A requirements file is optional but it can make it easier to manage dependencies. If you choose not use the file, make sure `pip install mkdocs` and `pip install THEME` lines are your instructions.
If you want to add, then include `requirements.txt` at the root. If your project is already a Python project, you might prefer to add `mkdocs` in `requirements-dev.txt` or at `docs/requirements.txt` to keep it isolated.This file should have `mkdocs` in it and also any themes if needed.
### Create a starter site
Run this command to create a starter site. This make the steps below go quicker.
```sh
cd my-project
mkdocs new PATH
```
The result will be same as the [Basic structure](#basic-structure) defined above and will include minimal text content generated by the MkDocs CLI. This text is defined in the project's [new.py](https://github.com/mkdocs/mkdocs/blob/master/mkdocs/commands/new.py) module.
### Set up a docs site
_Tip: Optionally use the `new` command covered above to set up the config and index page first and then continue_.
1. Create doc pages.
1. Create a `docs` directory.
2. Create `index.md` as your homepage.
3. Create other markdown pages (optional).
- Use placeholder content if you want to move on and then come back to expand them.
- If you have any existing markdown docs, these will work too.
2. Set up config.
1. Create `mkdocs.yml` at the project root.
2. Set up a navbar there.
3. Choose a theme.
3. Create a favicon (optional).
- It will be picked up at this path: `docs/img/favicon.ico`.
4. Add to your `.gitignore`.
- Add build directory. This will prevent it from being versioned on `master` branch.
- Add virtual environment, if using one.
You project should now look this this:
- `docs/`
- `index.md`
- More pages...
- `mkdocs.yml`
- `.gitignore`
- `venv`
- `requirements.txt` - optional
## Sample content
### Ignore file
`.gitignore`
```
site/
venv
```
### Navbar
`mkdocs.yml`
```yaml
nav:
- Home: index.md
- About: about.md
```
### Themes
#### Builtin
Use a builtin theme that comes with MkDocs.
The default.
```yaml
theme: mkdocs
```
Using ReadTheDocs theme and alternative config syntax.
```yaml
theme:
name: readthedocs
```
Find more [supported themes](https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes). If it doesn't immediately, you'll have to use `pip` to install it and add to a `requirements.txt` file.
#### ReadTheDocs Dropdown theme
See below using [mkdocs-rtd-dropdown](https://github.com/cjsheets/mkdocs-rtd-dropdown).
`requirements.txt`:
```
mkdocs-rtd-dropdown
```
`mkdocs.yml`:
```yaml
theme:
name: 'rtd-dropdown'
```
### Material for MkdDocs theme
See the [MkDocs for Material](https://squidfunk.github.io/mkdocs-material/) homepage. See the Set up page for config options.
`requirements.txt`:
```
mkdocs-material-extensions>=1.0
```
`mkdocs.yml`:
```yaml
theme:
name: 'material'
```

View File

@@ -0,0 +1,28 @@
# TL;DR
> A simplified version of the tutorial.
## Local setup
1. [Install](installation.md)
- `pip install mkdocs`
2. [Set up project](setup-project.md)
- `mkdocs new .` or [![Use this template](https://img.shields.io/badge/Use_this_template-2ea44f&logo=github)](https://github.com/MichaelCurrin/mkdocs-quickstart/generate)
3. [Run](usage.md)
- `mkdocs serve`
4. View on [localhost:8000](http://localhost:8000)
## Deploy to remote site
### Run deploy command locally
1. [Deploy](deploy.md) to GitHub Pages
- `mkdocs gh-deploy`
2. View published site on GitHub Pages at `https://USERNAME.github.io/REPO-NAME/`
### Run continuous integration
For CI/CD deploy, use GitHub Actions with an action such as [Deploy MkDocs](https://github.com/marketplace/actions/deploy-mkdocs). Or use Netlify.
This is not covered in this tutorial.

View File

@@ -0,0 +1,47 @@
# Usage
> Build and preview a site locally
Make sure to run all commands from the `docs` directory, as that is where `Makefile` is.
```sh
$ cd docs
```
## CLI help
```sh
$ make help
```
```
default: install
all: install build
h help:
install:
upgrade:
s serve:
b build:
d deploy:
```
## Serve docs
This will build the docs in memory (not to disk) and serve an auto-reloading server.
```sh
$ make serve
```
Then open in your browser:
- [localhost:8000](http://localhost:8000)
## Build docs
Build docs site to `site` directory. This is useful for a CI flow.
```sh
$ make build
```

View File

@@ -1,5 +0,0 @@
# MkDocs Quickstart
> A brief guide for setting up a MkDocs docs site on Github Pages
This is based on the [mkdocs.org](https://www.mkdocs.org/) tutorial.

23
docs/mkdocs.yml Normal file
View File

@@ -0,0 +1,23 @@
### Site metadata ###
site_name: MkDocs Quickstart
site_description: Starter template for a MkDocs docs site on GH Pages - including CI
site_url: https://michaelcurrin.github.io/mkdocs-quickstart/
repo_url: https://github.com/MichaelCurrin/mkdocs-quickstart
edit_uri: edit/master/docs/docs
### Build settings ###
theme: readthedocs
nav:
- Home: index.md
- About MkDocs: about-mkdocs.md
- Tutorial:
- TL;DR: tutorial/tldr.md
- Installation: tutorial/installation.md
- Set up project: tutorial/setup-project.md
- Advanced: tutorial/advanced.md
- Usage: tutorial/usage.md
- Deploy: tutorial/deploy.md

1
docs/requirements.txt Normal file
View File

@@ -0,0 +1 @@
mkdocs~=1.1,!=1.2

View File

@@ -1,43 +0,0 @@
# Setup and run
> How to setup and run the docs site
## Install
Install in a virtual environment.
```sh
pip install mkdocs
```
## Server docs locally
This will build the docs in memory (not to disk) and serve an auto-reloading server.
```sh
mkdocs serve
```
Open URL:
- [localhost:8000](http://localhost:8000)
## Build docs
Build docs site to `site` directory.
```sh
mkdocs build
```
Useful for production build or simulating that locally.
Remove stale files.
```sh
mkdocs build --clean
```

View File

@@ -1,31 +0,0 @@
# Tutorial
> How to create a MkDocs site.
This is a summary of the tutorial on [mkdocs.org](https://www.mkdocs.org/).
### Setup site
1. Create pages.
1. Create `docs` directory.
2. Create `index.md`
3. Create other pages.
2. Setup config.
1. Create `mkdocs.yml` at project root.
2. Setup navbar in `mkdocs.yml`.
```yaml
nav:
- Home: index.md
- About: about.md
```
3. Choose a theme.
```yaml
theme: readthedocs
```
3. Create a favicon.
- It will be picked up this path: `docs/img/favicon.ico`.
### Further configuration
See [Configuration](https://www.mkdocs.org/user-guide/configuration/) page on MkDocs site for options.

View File

@@ -1,9 +0,0 @@
site_name: MkDocs Quickstart
site_description: 'A brief guide for setting up a MkDocs docs site on Github Pages'
nav:
- Home: index.md
- Setup and run: setup_and_run.md
- Tutorial: tutorial.md
- Deploy: deploy.md
theme: readthedocs
repo_url: https://github.com/MichaelCurrin/mkdocs-quickstart/

BIN
sample.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB