Documentation
Everything you need to go from "the docs are in the repo" to "the docs are on the page". Ten minutes, no server, no OAuth.
Getting started
- Install SourceDocs from the Atlassian Marketplace (a Confluence admin does this once).
- Open a page, type
/sourcedocsand pick one of the three macros: File from Git, Diagram, Markdown. - For public repositories you are done. For private ones, an admin adds a read-only token under Settings → Apps → SourceDocs (see private repositories).
File from Git
Open the file in your Git provider's web UI and copy the address from the browser bar. Paste it into the macro. SourceDocs recognises these shapes:
| Provider | Link |
|---|---|
| GitHub | https://github.com/org/repo/blob/main/docs/arch.mdhttps://raw.githubusercontent.com/org/repo/main/docs/arch.mdhttps://github.com/org/repo (shows the README on the default branch) |
| GitHub wiki | https://github.com/org/repo/wiki/Getting-Startedhttps://github.com/org/repo/wiki (shows the Home page)[[Page Name]] wiki links become links to those pages. See GitHub wiki in Confluence. |
| GitLab.com | https://gitlab.com/group/subgroup/repo/-/blob/main/docs/arch.md |
| Bitbucket Cloud | https://bitbucket.org/workspace/repo/src/main/docs/arch.mdhttps://bitbucket.org/workspace/repo (README on the main branch) |
| Azure DevOps | https://dev.azure.com/org/project/_git/repo?path=/docs/arch.md&version=GBmainWithout version the repository's default branch is used; GT (tag) and GC (commit) versions work too. https://dev.azure.com/org/project/_git/repo shows the README. |
| Your own server | GitLab self-managed or Dedicated: https://git.example.com/group/repo/-/blob/main/docs/arch.mdGitHub Enterprise Server or ghe.com: https://github.example.com/org/repo/blob/main/docs/arch.mdThe server must first be added on the admin page; see Your own Git server. |
The branch, tag or commit in the link is what gets shown. Point at main for "always current", at a tag for a frozen version. Branch names containing a slash (release/2.0, feature/login) work as well.
The file type decides the rendering:
.md,.markdown,.mdx: Markdown.mmd,.mermaid: Mermaid diagram.puml,.plantuml,.iuml,.wsd, or any text file starting with@startuml: PlantUML.yaml,.yml,.jsoncontaining anopenapiorswaggerfield: API reference- Anything else: syntax-highlighted source (40+ languages)
Use Preview in the dialog to check the file before saving. On the page, the bar above the content shows the provider, path, branch and the time of the last fetch; Refresh fetches the latest version immediately (otherwise SourceDocs re-fetches at most every 10 minutes).
Confluence search. With Searchable in Confluence on (the default), saving the macro stores a plain-text copy of the file, up to 20,000 characters, in the macro, so Confluence search finds the page by words inside the file. The copy reflects the file when the macro was last saved: after larger changes in the repository, open the macro and save it again. Text written in the Diagram and Markdown macros is searchable as it is. Macros added before version 1.6 become searchable the next time they are saved.
Private repositories
A Confluence administrator stores one read-only token per provider on the admin page: Confluence Settings → Apps → SourceDocs. Every macro on the site then uses it; page authors and readers do not need their own Git access. Readers see whatever the author embedded, so embed with the same care as pasting.
| Provider | Token to create |
|---|---|
| GitHub | Fine-grained personal access token: Resource owner = your organisation, Repository access = only the repositories you embed, Permissions → Contents: Read-only. Classic tokens with the repo scope also work. Organisations with SSO must authorise the token for the organisation. |
| GitLab.com | Personal access token, or a group/project access token, with scope read_repository and role Guest or higher. A project access token is the tightest option. |
| Bitbucket Cloud | Repository access token (Repository settings → Access tokens) or workspace access token with Repositories: Read. An Atlassian API token with the read:repository:bitbucket scope also works: enter it as email:api_token, that is the Atlassian account email, a colon and the token, with no spaces. (Bitbucket app passwords no longer work.) |
| Azure DevOps | Personal access token (User settings → Personal access tokens) with Code: Read, scoped to the organisation. |
After saving, paste a file link from a private repository into the box under the list of connected providers and click Test: SourceDocs fetches that file with the token. Without a link the test asks the provider who the token belongs to, which Bitbucket does not answer for access tokens, so for Bitbucket always test with a link. Tokens are never shown again and never leave Atlassian; see the security page.
Your own Git server
SourceDocs also reads files from GitLab and GitHub Enterprise running on your company's own server: GitLab self-managed and GitLab Dedicated, GitHub Enterprise Server and GitHub Enterprise Cloud with data residency (ghe.com). Bitbucket Data Center and Azure DevOps Server are not supported yet; write to [email protected] if you need them.
- On the admin page (Confluence Settings → Apps → SourceDocs), under Your own Git servers, choose the type and enter the server's address, for example
https://git.example.com. - Click Add server. Atlassian shows its own dialog naming the server; an Atlassian administrator approves it. Forge then lets SourceDocs reach that server and nothing else new. The approval can be reviewed or withdrawn in Atlassian administration under the app's data management, or by removing the server on the admin page.
- If the repositories are private, add a token for the server under Add or replace a credential (the same token types as GitLab.com and GitHub), then click Test with a file link from the server.
The server must be reachable from Atlassian's cloud over HTTPS with a publicly trusted certificate. If it is behind a firewall, allow Atlassian's outgoing IP addresses (the Forge platform uses them). Servers installed under a path (https://example.com/gitlab) are not supported yet. Up to 10 servers per site.
Diagram macro
Choose Mermaid or PlantUML, type on the left, watch the preview on the right. The editor shows line numbers, so an error such as "Parse error on line 12" points straight at the line. Insert example gives you a starting point for each diagram type. Ctrl+Enter saves.
- Mermaid 12: flowcharts, sequence, class, state, ER, Gantt, pie, mind maps, timelines, C4, architecture and the rest. Add a front-matter block to use the ELK layout engine for large flowcharts:
Raw HTML tags in labels are stripped so they do not cause syntax errors;--- config: layout: elk --- flowchart TB A --> B<br>is kept. - PlantUML 2026: sequence, class, component, deployment, use case, activity, state, mind map, WBS, Gantt, JSON/YAML, Salt wireframes and more, rendered entirely in the browser.
- PlantUML
!include: the C4-PlantUML library (!include <C4/C4_Container>or its raw GitHub URL), any Git file link SourceDocs understands, and paths relative to the file being shown (!include common/styles.puml). Included files are fetched through the app like any other file, with the stored credential for private repositories. The PlantUML standard library works too (<awslib/...>,<tupadr3/...>,<kubernetes/...>and others), as do include prefixes set with!defineor!$variable, so the AWS, Azure and Kubernetes icon libraries draw as in their documentation. - Theme: "Match Confluence" follows the reader's light or dark mode; or pin one of Mermaid's themes.
On the page, the toolbar above each diagram has zoom out/in, reset, full screen, download SVG or PNG, and copy source. "Fit diagrams to page width" shrinks wide diagrams to fit without clipping and never blows small ones up; turn it off to keep natural size with scrolling.
Markdown macro
Markdown written in the page with the same split editor. Useful for release notes, tables and checklists written by engineers who prefer text, and for pasting Markdown produced by AI assistants or CI without reformatting.
What Markdown is supported
- GitHub-flavoured Markdown: headings, emphasis, lists, nested lists, task lists (
- [x]), tables, blockquotes, horizontal rules, autolinks, inline and fenced code with highlighting. - Fenced
mermaid,plantumlandpumlblocks render as diagrams. - GitHub alerts:
> [!NOTE],[!TIP],[!IMPORTANT],[!WARNING]and[!CAUTION]blockquotes appear as coloured callouts. - YAML front matter (Jekyll, Hugo, Docusaurus, MkDocs) at the top of a file is shown as a small table instead of stray text.
- Raw HTML commonly found in READMEs (
<p align="center">,<img>,<details>,<kbd>) is rendered after sanitisation; scripts, styles and forms are removed. - Relative links (
[guide](./docs/guide.md)) open the file in the provider's web UI in a new tab. Anchor links (#section) scroll within the page; heading ids follow GitHub's slug rules. - Relative images (
) are fetched from the repository with the stored token, so images in private repos work. Absolute image URLs are loaded directly by the browser from GitHub, GitLab, Bitbucket, Azure DevOps and common badge services (shields.io, badgen, Codecov, Coveralls, SonarCloud and others); images on other hosts appear as a link unless an admin allows images from any website on the admin page (Atlassian asks the admin to approve it).
OpenAPI and Swagger
Point the File from Git macro at an OpenAPI 3.0 or 3.1 document (YAML or JSON) or a Swagger 2.0 document. SourceDocs shows a three-column API reference: navigation by tag and operation, descriptions and parameters, request and response samples with schema details. Search is built in. There is deliberately no "Try it out": nothing is sent anywhere from the page. HTML inside descriptions is sanitised before it is shown: scripts, event handlers, javascript: links and embedded frames are removed.
Long APIs (more than 30 paths, or longer than about three screens once drawn) are shown in their own scrolling window, with the operation menu kept in view, so they do not turn the Confluence page into an endless scroll. The menu and search stay visible on default-width Confluence pages.
PDF export
SourceDocs exports as real Confluence content, so PDF and Word files paginate like the rest of the page instead of printing a screenshot of the macro:
- Markdown and READMEs become native headings, paragraphs, lists, tables and code blocks; GitHub alerts become Confluence panels; images from the repository are embedded. Text flows across pages and is never cut through a line.
- OpenAPI becomes a printable API reference: one section per operation with parameter, request-body and response tables, example JSON and a schema section.
- Diagrams are embedded as sharp vector pictures in the light theme. SourceDocs keeps the picture of each diagram a reader has seen, so a page that was opened after its last edit exports instantly. A diagram nobody has viewed yet is printed from the live macro instead.
- Code becomes a Confluence code block with syntax highlighting (the first 4,000 lines of very long files).
- Each exported Git file starts with a small "Source" line linking to the file and the date it was fetched.
Badges and images hosted outside GitHub and GitLab appear in exports as links with their alt text.
Troubleshooting
| Message | Meaning and fix |
|---|---|
| That link is not recognised | Copy the address of the file (not a folder or a search page) from the browser bar. Supported shapes are listed above. |
| File not found | Wrong path or branch, or the repository is private and no token is stored. Check the link in the provider's UI; ask an admin to add a token. |
| Access denied | The stored token is missing, expired, revoked, lacks read access to this repository, or (GitHub organisations with SSO) is not authorised for the organisation. Replace it on the admin page and click Test. |
| Rate limiting | Public GitHub files are read from GitHub's raw file host, which has no hourly limit for normal use. Public Bitbucket Cloud access without a token allows 60 requests per hour; add a token to raise it. The 10-minute cache keeps normal traffic far below these limits. |
| Diagram shows a syntax error | The error text comes from Mermaid or PlantUML and names the line. Fix it in the editor; the preview updates as you type. |
| Image shown as a link with a picture icon | The image is hosted on a site outside the app's image allow-list. A Confluence admin can click Allow images from any website on the admin page, or you can move the image into the repository (a relative path always works). |
| PlantUML "cannot include" | The included file could not be fetched: check the path, or add a credential if it is in a private repository. Supported: absolute links to Git files, paths relative to the diagram, the standard library (<C4/...>, <awslib/...>, <tupadr3/...>, <kubernetes/...> and others) and prefixes set with !define or !$variable, as the AWS, Azure and Kubernetes icon libraries use them. Includes from hosts other than GitHub, GitLab, Bitbucket, Azure DevOps and the servers added on the admin page are not supported. |
| "SourceDocs could not reach" a server | The server is not reachable from Atlassian's cloud (firewall, private network, certificate not publicly trusted), or its approval was withdrawn. Check that it answers from the internet or allow Atlassian's outgoing IP addresses, then remove the server on the admin page and add it again. |
| Image missing (dashed box) | The image path does not exist in the repository at that branch, or it is larger than 1 MB. |
Limits
- Files up to 16 MB; images up to 1 MB. Files above 256 KB travel compressed, so very large files that do not compress well (rare for text) may be refused with a message.
- Source files above 500 KB are shown without syntax highlighting, so the page stays responsive.
- Very large OpenAPI specifications take a few seconds to draw in the browser: GitHub's own REST API description (13.5 MB, 1,500 operations) takes about 15 seconds.
- Cache: 10 minutes per file, per site, stored compressed. Files whose compressed size is above 200 KB (usually above 2 MB of text) are fetched on every view. Refresh bypasses the cache.
- Supported hosts: github.com, gitlab.com, bitbucket.org, dev.azure.com, and up to 10 of your own GitLab or GitHub Enterprise servers added on the admin page. Bitbucket Data Center and Azure DevOps Server are not supported yet.
Migrating from other apps
Pages using other Markdown, Mermaid or PlantUML macros keep working; add SourceDocs macros alongside and remove the old ones when ready. Diagram sources are plain text in both: copy from the old macro's editor into the SourceDocs editor. If you have many pages, write to [email protected] and we will help plan the switch.
Release notes
| Version | Date | Changes |
|---|---|---|
| 1.9 | November 2026 | When a private repository is embedded before a token is saved, the macro now says so and names the admin page, instead of only "File not found" (GitHub, GitLab and Bitbucket answer "not found" for private repositories). On the admin page, testing a Bitbucket access token without a file link no longer reports "Access denied". |
| 1.8 | November 2026 | Security update: DOMPurify 3.4.17 and current versions of the other libraries. HTML inside OpenAPI descriptions is now sanitised as well, as Markdown already was. |
| 1.7 | October 2026 | Links inside rendered Markdown, the repository link above each file and the links on the admin page open again, after Atlassian's usual prompt for external sites; Confluence's app frame had been blocking them. The admin page shows how to reach support. |
| 1.6 | October 2026 | Confluence search finds pages by the content of SourceDocs macros: words in a file embedded with File from Git (a plain-text copy saved with the macro, switchable per macro with Searchable in Confluence), and the text written in Diagram and Markdown macros. Existing macros become searchable the next time they are saved. See Confluence search. |
| 1.5 | October 2026 | GitHub wiki pages: paste the address of a wiki page (or of the wiki for its Home page); [[Page Name]] wiki links and images in the wiki work. |
| 1.4 | October 2026 | Diagrams in PDF and Word exports sit on a white background, so they stay readable when Word shows the page dark, and transparent areas of PlantUML diagrams (such as C4 boundaries) no longer turn black in Word. Very tall diagrams are capped at about two thirds of a page, so the heading above them more often stays on the same page. Mermaid diagrams inside Markdown redraw when Confluence switches between light and dark. Long API references (more than about three screens) open in their own scrolling window. markdown-it 15.0.3 (security fix). New macro icons. |
| 1.3 | October 2026 | Files up to 16 MB instead of 2 MB: large files travel and are cached compressed, so big OpenAPI specifications such as GitHub's own REST API description show on the page. Line numbers in the Mermaid and PlantUML editor. Source files above 500 KB are shown without syntax highlighting to keep the page responsive. APIs with more than 30 paths get their own scrolling window with a fixed menu, and the API menu and search now show on default-width pages. |
| 1.2 | October 2026 | Your own Git servers: GitLab self-managed and Dedicated, GitHub Enterprise Server and ghe.com, each added on the admin page and approved by an Atlassian administrator in Atlassian's own dialog. Optional images from any website. PlantUML standard library includes (<awslib/...>, <tupadr3/...> and others) and !define include prefixes, so the AWS, Azure and Kubernetes icon libraries work. Diagram toolbar in its own strip above the drawing, full screen opens fitted to the window, and the editor keeps showing the last valid drawing while you type. |
| 1.1 | October 2026 | PlantUML diagrams written without @startuml. Cached files and export pictures are deleted automatically when they expire. PDF and Word export as native Confluence content (Markdown, OpenAPI, code) with embedded diagram pictures. PlantUML !include and C4-PlantUML; class, component, use case, state and C4 diagrams use PlantUML's built-in layout inside Confluence. GitHub alerts and YAML front matter in Markdown. Repository-root links for Bitbucket and Azure DevOps, Azure default branch, tags and commits, branch names with "/". Mermaid class diagrams with <<interface>> stereotypes. README banner images linked to GitHub file pages. Better contrast for API references in dark mode. |
| 1.0 | October 2026 | Initial release. Mermaid 12.1 with ELK layout, PlantUML 1.2026.8, markdown-it 15, Redoc 2.5 (OpenAPI 3.0/3.1, Swagger 2.0), highlight.js 11. |