Lesson 1 of 3 Collaboration and Documentation

Documenting Projects with Wikis, Markdown and Mermaid

This lesson compares wiki options, and shows how to write Markdown and Mermaid diagrams.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish project wikis from code wikis.
  • Describe documentation options in GitHub.
  • Write common Markdown syntax.
  • Write a Mermaid diagram for each platform.

Wiki options in Azure DevOps

Azure DevOps offers two kinds of wiki, and the difference is a common exam point.

Project wiki

A project wiki is provisioned once for a project. Its pages are stored in a hidden Git repository, and people edit them in the web interface. It suits general team knowledge, such as onboarding guides and meeting notes, and people who do not use Git can contribute. A project has one project wiki.

Code wiki

A code wiki publishes a folder of Markdown files from an ordinary repository branch. A project can have several. Pages change through normal commits and pull requests, so documentation can be reviewed with the code that it describes, and a branch can be published for each version of a product. This suits technical and API documentation that must match a release.

The following comparison summarizes when to use each kind.

Project wiki
StorageHidden Git repository for the project
EditingWeb interface, with direct saves
ReviewRevisions are kept, with no pull request step
VersionsOne current version
Choose when Everyone should be able to edit quickly.
Code wiki
StorageFolder in an existing repository
EditingCommits, usually through pull requests
ReviewBranch policies apply
VersionsOne per published branch
Choose when Documentation must be reviewed and versioned with the code.

The following diagram compares a code wiki with a project wiki for installation steps that differ by product version.

Code wiki against project wiki for versioned installation steps. A code wiki publishes one branch per supported version and takes changes through pull requests, where a branch policy can require the technical lead's approval. A project wiki has a single current version and no pull request step.
The scenario is illustrative.
Sort into groups

Project wiki or code wiki?

Exam skills 1.3.1

Decide which kind of Azure DevOps wiki each need points to.

Log in to try this activity Interactive activities are free with an account.

Documentation in GitHub

Every GitHub repository can show Markdown files directly, and README.md appears on the repository's main page. Teams often keep a docs folder, which goes through pull requests like code. A repository can also have a wiki, which is a separate Git repository with its own history, and GitHub Pages publishes a static site from a branch or an Actions workflow. For public documentation, Pages combined with a static site generator is common.

Community health files, such as CONTRIBUTING.md and SECURITY.md, are another form of project documentation. They tell contributors how to work with a repository.

Match the pairs

Where GitHub documentation lives

Exam skills 1.3.1

Match each documentation need with the GitHub feature that serves it.

Log in to try this activity Interactive activities are free with an account.

Markdown essentials

Markdown is a plain-text format. Both platforms support the common syntax, including headings, lists, links, images, tables and code blocks. The following example shows the most used elements.

# Deployment guide

## Prerequisites

- An Azure subscription
- **Contributor** access to the resource group

Run the following command:

```bash
az group create --name rg-app --location westeurope
```

| Environment | Region        |
|-------------|---------------|
| Test        | West Europe   |
| Production  | North Europe  |

See the [runbook](./runbook.md) for details.

Each platform also has its own extensions. Azure DevOps wikis offer [[_TOC_]] for a table of contents, #123 to link a work item and @ mentions. GitHub offers task lists with - [ ], automatic links to issues with #123, and alert blocks such as [!NOTE].

Sort into groups

Which platform's Markdown extension?

Exam skills 1.3.1

Tell apart the Markdown extensions of Azure DevOps wikis and GitHub.

Log in to try this activity Interactive activities are free with an account.

Mermaid process diagrams

A diagram stored as an image soon falls out of date, since few people can edit the original, and a change cannot be reviewed line by line. Mermaid solves this by describing a diagram as text. It supports flowcharts, sequence diagrams, Gantt charts, class diagrams and more. Because the source is text, it lives in Git and appears clearly in a pull request.

The syntax for embedding it depends on the platform. An Azure DevOps wiki page uses a block fenced with three colons. GitHub uses a fenced code block with the language set to mermaid. The following example shows a release process in an Azure DevOps wiki.

::: mermaid
flowchart LR
    A[Pull request] --> B{Checks pass?}
    B -- Yes --> C[Merge to main]
    B -- No --> A
    C --> D[Deploy to test]
    D --> E{Approved?}
    E -- Yes --> F[Deploy to production]
:::

The first line declares the diagram type and its direction, with LR meaning left to right and TD meaning top down. Square brackets draw a rectangle, curly braces draw a decision, and arrows connect the nodes, with optional labels. The same diagram in GitHub Markdown would be placed in a fenced block, as follows.

```mermaid
sequenceDiagram
    participant Dev
    participant Pipeline
    participant Azure
    Dev->>Pipeline: Push commit
    Pipeline->>Azure: Deploy
    Azure-->>Pipeline: Health check result
```
Scenario questions

Reading Mermaid syntax

Exam skills 1.3.1

Interpret the parts of a Mermaid flowchart.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing where documentation lives

A team maintains two supported versions of a product in Azure Repos. Each version has different installation steps. Documentation changes must be approved by a technical lead, and readers must be able to see the correct steps for each version. What should you recommend?

A code wiki meets all three requirements. It can publish one branch per version, so readers see the correct steps. Because changes go through pull requests, a branch policy can require the technical lead's approval. A project wiki has a single current version and no pull request step, and a Word document in a shared folder cannot be reviewed alongside the code.

Check yourself

How does the Mermaid syntax differ between an Azure DevOps wiki and GitHub?

Show answer

An Azure DevOps wiki uses a ::: mermaid block, and GitHub uses a fenced code block with the language set to mermaid.

Exam Tips

Remember for the exam

  • A project wiki is edited in the web interface; a code wiki is published from a repository.
  • Use a code wiki when documentation needs pull request review or versions.
  • Azure DevOps uses ::: mermaid blocks; GitHub uses a fenced mermaid block.
  • Text-based diagrams can be reviewed and changed like code.
  • [[_TOC_]] adds a table of contents to an Azure DevOps wiki page.