Tree views in Confluence

A tree view shows a hierarchy of folders and files as an indented tree.

Last updated

When to use it

Use a tree view to show the layout of a repository or of a deployment folder in a README-style page. You write the names with indentation and the diagram draws the tree lines, which is easier to keep right than characters typed by hand.

Example

This is the code of the Monorepo layout template: the folder tree of apps, packages and infrastructure in a monorepo.

treeView-beta
  monorepo/
    apps/
      web/
        src/
        package.json
      api/
        src/
        package.json
    packages/
      ui/
        src/
        package.json
      config/
        tsconfig.base.json
        eslint.config.js
    infra/
      terraform/
        main.tf
        variables.tf
    package.json ## workspace root
    pnpm-workspace.yaml ## lists apps and packages

Vellnar Diagrams draws it like this:

Change a line and the diagram changes with it. Nobody needs the original drawing file, because there is none: the code is the diagram.

Add it to a Confluence page

  1. Edit a Confluence page and type /mermaid where the diagram should go.
  2. Select Mermaid diagram. The editor opens with the template list.
  3. Pick a template, or choose Start blank and paste the code above. The preview follows every keystroke.
  4. Choose Save. The diagram appears on the page.

The documentation covers the editor, the settings and the exports.

Templates

The Templates button in the editor has one tree view ready to use:

  • Monorepo layout: The folder tree of apps, packages and infrastructure in a monorepo.

Syntax

The code of a tree view starts with treeView-beta. The Mermaid documentation describes every element of the syntax. Vellnar Diagrams draws it with Mermaid 12.3; if a line has an error, the editor marks the line and keeps the last valid diagram on screen.

More

  • Mermaid in Confluence: how diagrams as code work in a page, and every diagram type.
  • Security: the app asks for no permissions and sends nothing outside Atlassian.