Docs As Code, for Coders

A presentation at TechMids in October 2023 in Birmingham, UK by Lorna Jane Mitchell

Slide 1

Slide 1

Docs-as-code, for Coders Lorna Mitchell, Redocly @redocly ~ @lornajane

Slide 2

Slide 2

What is Docs-as-code? Manage documentation using coder tools @redocly ~ @lornajane

Slide 3

Slide 3

Benefits of docs-as-code •Changes can be made quickly and simultaneously •Powerful collaboration and review tools •Single source of truth •Separation of content and presentation •Audit trail @redocly ~ @lornajane

Slide 4

Slide 4

Programmers have the best tools @redocly ~ @lornajane

Slide 5

Slide 5

Toolbox •Editors with syntax support •Local preview •Source control •Linting/formatting •CI/Pull request workflow @redocly ~ @lornajane

Slide 6

Slide 6

DocOps: Code + words @redocly ~ @lornajane

Slide 7

Slide 7

Markdown / Markdoc ## One large file to many small ones OpenAPI is designed with support for $ref syntax, allowing parts of an API desc If you have one large single file, split it up like this: redocly split openapi.yaml --outDir myApi The original file is unchanged, but look in the directory named by the --outDir * An openapi.yaml file, which is the entry point of the API and includes the i * Apaths/` directory, with a file for each of the URLs in the API. All verbs fo @redocly ~ @lornajane

Slide 8

Slide 8

ReStructuredText Stats ===== redocly stats discourse.yaml Lint ==== redocly lint discourse.json --extends=minimal --format=summary Then add max-problems=200 Minimal rules: https://redocly.com/docs/cli/rules/minimal/ @redocly ~ @lornajane

Slide 9

Slide 9

AsciiDoc

  • A selection of endpoints with specific behaviours at http://httpbin.org/[httpb Register your own endpoint at http://requestb.in and use it in place of http://re [[curl]] ==== Command Line HTTP http://curl.haxx.se[Curl] is a command-line tool available on all platforms. In its most basic form, a Curl request can be made like this: —-curl http://requestb.in/example —-@redocly ~ @lornajane It

Slide 10

Slide 10

QA for prose In CI, and locally: •Validate the markup •Use a prose linter such as Vale https://vale.sh/ •Check links •Build output preview @redocly ~ @lornajane

Slide 11

Slide 11

Pull request workflow Everything you know about good pull request practice? Do that. @redocly ~ @lornajane

Slide 12

Slide 12

Git and writers Help others adopt the workflow: •Find tools and resources that work for them •Be prepared to provide a lot of support Experts of other disciplines may learn or work differently @redocly ~ @lornajane

Slide 13

Slide 13

Developers and Docs @redocly ~ @lornajane

Slide 14

Slide 14

Audience and goals WHO are you writing for? WHAT will they gain? @redocly ~ @lornajane

Slide 15

Slide 15

Outline before writing Preparation makes the process easier @redocly ~ @lornajane

Slide 16

Slide 16

Content types From https://diataxis.fr: •Concept •Task •Tutorial •Reference @redocly ~ @lornajane

Slide 17

Slide 17

Docs and Coders Engineering is about solving problems and helping people. So is documentation. @redocly ~ @lornajane

Slide 18

Slide 18

Resources •https://lornajane.net •https://redocly.com •https://idratherbewriting.com/ •https://docsfordevelopers.com/ @redocly ~ @lornajane