DocuGate

What is docs-as-code?

Docs-as-code explained: documentation written in plain text, kept in Git beside the code, reviewed in pull requests and published automatically.

By ·

The short answer

Docs-as-code is writing documentation with the same tools and workflow as software: plain-text files such as Markdown, kept in version control next to the code, changed through pull requests and review, and published automatically when changes merge. The result is that docs can change in the same commit as the behaviour they describe.

The short answer

Docs-as-code treats documentation as part of the codebase instead of a separate wiki. Pages are text files in Git. They are written in the same editor, changed on the same branches, reviewed in the same pull requests and published by the same kind of automation as the code. The term is used widely in technical writing; the practice matters more than the name.

What it involves

  • Plain-text formats. Markdown most often, sometimes reStructuredText or AsciiDoc. Diffs are readable and no tool owns the content.
  • Version control. Every change has an author, a date and a reason, and docs can be branched and tagged with releases.
  • Review. A pull request that changes behaviour can be required to update the docs, and reviewers see both at once.
  • Automated checks. Broken links, missing titles and spelling are caught in CI before anything is published.
  • Automated publishing. A merge to the main branch updates the live site.

Why teams adopt it

Documentation goes wrong when it drifts from the product. Keeping it beside the code shortens the distance between the change and the page that describes it. It also removes a separate tool and login for engineers, gives docs the same history and rollback as code, and makes the docs easy to move: they are just files.

What it costs

It assumes writers are comfortable with Git. Product managers, support staff and technical writers who are not may find the workflow slower than a wiki. Review can become a bottleneck. And publishing needs a pipeline that someone owns.

Common tools

ToolHow it publishesNotes
DocusaurusBuilds a static React siteRich plugins and MDX; you host the output
MkDocsBuilds a static site from MarkdownSimple configuration; Material theme is popular
SphinxBuilds HTML, PDF and moreStrong for Python and long technical manuals
Jekyll or Hugo with GitHub PagesBuilds on pushFree hosting; public unless on GitHub Enterprise Cloud
DocuGateReads Markdown from GitHub on request, no buildFolders become navigation; access control per space

Getting started

  1. Create a docs/ folder in the repository and move existing pages into it as Markdown.
  2. Add an index.md as the landing page and group pages into folders.
  3. Add a check to CI, for example a link checker.
  4. Require docs changes in the pull request template for user-facing changes.
  5. Connect a publisher so a merge updates the site.

DocuGate is one publisher for that last step. It reads the docs folder on the branch you choose: folders become sidebar groups, the first # heading becomes the title, and a push invalidates the cache so the next request reads the new commit. The docugate CLI's check command catches broken links before they are published. Each space can be public or gated; see access control.

Questions people also ask

Is docs-as-code only for developer documentation?

No. Handbooks, runbooks, policies and partner guides work the same way. The limit is the writers: people who never use Git need a way to edit that does not ask them to learn it.

Do I need a static site generator for docs-as-code?

Not necessarily. Generators such as Docusaurus or MkDocs are the common route, but some platforms read the markdown straight from the repository and render it without a build.

Markdown, reStructuredText or AsciiDoc?

Markdown is the most widely known and is supported almost everywhere. reStructuredText, used by Sphinx, and AsciiDoc handle cross-references and long technical books better. Pick the one your writers will actually use.

Where should the docs live, in the code repository or a separate one?

In the code repository when the docs describe that code, so a change and its documentation share one pull request. A separate repository suits docs that span several products or are written by a different team.

Read next

Get started with DocuGate, free.