nightscout / trio-docs

GNU Affero General Public License v3.0
10 stars 14 forks source link

Repository for Trio documentation (under development)

Install

Run

Preview Changes

Once installed, you can preview the doc locally as you make changes:

Build the Website Locally

cd trio-docs # where you cloned the trio-docs repository
source venv/bin/activate # Do this once when opening a shell or if the shell prompt no longer displays `(venv)`

mkdocs build

This does not generate the website's PDF version.

Build the PDF

To export the website as a PDF:

cd trio-docs # where you cloned the trio-docs repository
source venv/bin/activate # Do this once when opening a shell or if the shell prompt no longer displays `(venv)`

MKDOCS_EXPORTER_PDF=true  mkdocs build

The PDF file is generated insite/trio-docs.pdf.

Contribute

You can contribute to the Trio documentation by correcting typos or suggesting new content.

Using the Terminal

cd trio-docs # where you cloned the trio-docs repository

# Activate the Python virtual environment 
#  (if the shell prompt does not display `(venv)`)
source venv/bin/activate

# Declare the official remote trio-docs GitHub repository 
# The remote repository name convention is:
# - origin denotes your copy of the `trio-docs` repository on GitHub
# - upstream denotes the official `trio-docs` repository on GitHub
# You already created `origin` before.
# `upstream` does not exist yet, we now need to create it.
#
# These are shortcuts for the remote repositories 
#   short name => long name (URL)
# We use the short name not to memorize and type the long name (see line below) each time we need to interact with it.
#
git remote add upstream https://github.com/nightscout/trio-docs.git

# Fetch the changes from the remote repositories
git fetch origin
git fetch upstream

# Jump on the `dev` branch
# `dev` contains the source code for the site ready to be deployed)
git switch dev

# Bring recent changes for the `dev` branch back from the official trio-docs repository (`upstream`)
git merge upstream/dev

# Example: We want to add a FAQ page in the `docs/resources/` folder

# Create (`-c`) and jump on a new feature branch where to add the FAQ page
#
git switch -c add_FAQ_page

# Create then edit the new FAQ file (`faq.md`)
MY_FAVORITE_EDITOR_HERE docs/resources/faq.md

# Edit, preview, repeat...
# until you are satisfied with the changes.

# ➡️ 🏬: Add the FAQ page to the warehouse
git add docs/resources/faq.md

# 🏬 ➡️ 🚚: Move all the changes from the warehouse into your **local** repository 
git commit -am "Add FAQ page"

# 🚚 ➡️ ⛅️: Push your feature branch `doc/add_FAQ_page` to your remote repository
git push -u origin add_FAQ_page

Add a Plugin

Tips & Tricks

[!NOTE] Please add!

Add a Chapter

Using the # sign shows a chapter on the menu/index. The amount of #'s determines the level.

Example:

# README

## Tips & Tricks

### Add a Chapter

### Link to Another File

[!TIP] If you want to avoid a chapter ending up in the menu/index, use bold text by:

  • either surrounding the text with 2-star signs **
  • or adding <b> before the text and </b> after the text (without spaces).
Input Result
**bold text** bold text
<b>bold text</b> bold text

Link to Another File

When linking to another Markdown file (ending with .md) in another directory, the link must start with ../.

Example: ../directoryname/filename.md

Migrate a Sphinx page to Mkdocs

Migrate an Admonition from Sphinx to Mkdocs

[!NOTE] What is an admonition?
An admonition is a rectangular box with a title (optional) and a text body.
Each admonition type has a specific icon and box border color.

For instance, a warning admonition has a yellow icon and border. Its icon is an exclamation sign in a yellow triangle.

This is what an admonition looks like in Sphinx:

:::{warning}
This is not medical advice.  
Understanding the changes you are making is important, and always be sure to exercise caution.  
When in doubt, consult your diabetes care team for settings guidance.
:::

Here is what the same admonition looks like in "Mkdocs-material":

!!! warning

    This is not medical advice.
    Understanding the changes you are making is important, and always be sure to exercise caution.
    When in doubt, consult your diabetes care team for settings guidance.

where:

[!TIP] Separate the Title and Body with an Empty Line

  • Adding a blank line (4 spaces indented) between the title and the body of the text makes a visual distinction for the reader. This is not required.
  • When present in the body text, empty lines must also use a 4-space indentation.

[!NOTE] Mkdocs (the site generation engine) does not provide admonitions but mkdocs-material (the theme) does via the pymdownx Markdown extension.