Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Creating a content pipeline with Antora

Creating a content pipeline with Antora

Using AsciiDoc content for the website and other downstream processes

Video and demo repository: https://www.ahus1.de/post/content-pipeline-antora

For a project of a reasonable size, there's usually more than one source for the website that needs to be published. For several years, Antora is known as a site generator which pulls AsciiDoc content from multiple Git repositories at once. It publishes a static website where users find a navigation, online search and linked pages, with the option to group everything by component versions.

In 2022, Antora made the leap to open its publishing process to plugins: They allow pulling information dynamically during the build process and forward the content not only to a static HTML site, but other targets like PDF as well. This talk outlines what is possible today with these extensions, and how it can be extended for custom needs.

Alexander Schwartz

February 05, 2023
Tweet

More Decks by Alexander Schwartz

Other Decks in Programming

Transcript

  1. Using AsciiDoc content for the website and other downstream processes

    Creating a content pipeline with Antora FOSDEM 2023 | Brussels | 2023-02-05 Alexander Schwartz & Fabrice Flore-Thébault CC-BY 2.0 Alexander Schwartz and Fabrice Fabrice Flore-Thébault
  2. https://octoverse.github.com/2021/creating-documentation/ “At work, developers consider documentation trustworthy when it is

    up-to-date (e.g., looking at time-stamps) and has a high number of upvotes from others. Open Source projects use READMEs, contribution guidelines, and GitHub Issues, to elevate the quality of any project, and to share information that makes them more attractive to new contributors.” No matter the format, documentation is important
  3. Source: https://www.jason.af/effective-devrel-buffalo-stick/ “Sarah [Drasner] would encourage us to ‘use every

    part of the buffalo’ (don't let work go to waste) and also to ‘feed two birds with one scone’ (make one piece of work accomplish two goals). At some point she mashed this up into ‘scratch multiple buffalo with one stick’, and that phrase lives rent-free in my head ever since. (And — now that you've heard it — probably yours, too. You're welcome.)”
  4. content: sources: - url: https://github.com/eclipse-che/che-docs branches: - 7.58.x - che-7-redirections

    - main edit_url: "https://github.com/eclipse-che/che-docs/... # ... ui: bundle: url: https://gitlab.com/antora/antora-ui-default/... snapshot: true supplemental_files: ./supplemental-ui output_dir: docs/_ # ... Antora Playbook Tell it where to find the content, the UI theme and where to store the output.
  5. https://gitlab.com/antora/antora-collector-extension Generate content using your tools: Antora is in charge!

    Antora Collector ext: collector: - run: command: ./tools/validate_language_changes.sh - run: command: ./tools/checluster_docs_gen.sh scan: base: modules/administration-guide/examples/ dir: build/collector/checluster-properties files: checluster-properties.adoc
  6. Antora Assembler https://gitlab.com/antora/antora-assembler Create one monolithic AsciiDoc per module: Portable,

    no Antora specifics! root_level: 1 component_versions: '*' section_merge_strategy: fuse build: command: > asciidoctor-pdf --attribute toclevels=5 --trace --sourcemap keep_aggregate_source: true
  7. Antora single-sourcing Separate content authoring and publication Built to handle

    content variations: • AsciiDoc attributes support • Examples, images, partials • Distributed components • Antora Collector harvests content • at build time Antora Assembler outputs a monolithic AsciiDoc hiding away Antora structure
  8. Authoring vs. publication https://docs.antora.org/antora/latest/playbook/set-up-playbook/ Playbook, components, and UI in one

    or more Git repositories and branches content: sources: # Content in the upstream repository: - url: https://github.com/eclipse-che/che-docs branches: 7.56.x # Downstream content in current repository: - url: ./ branches: HEAD ui: bundle: url: https://gitlab.com/antora/...
  9. AsciiDoc attributes https://docs.antora.org/antora/latest/component-attributes/ https://docs.antora.org/antora/latest/playbook/asciidoc-attributes/ AsciiDoc attributes in a component or

    a playbook enable inline content variation asciidoc: attributes: orch-cli: kubectl prod: Eclipse Che project-context: che asciidoc: attributes: orch-cli: oc prod: Red Hat OpenShift Dev Spaces project-context: devspaces
  10. Antora file and directory set https://docs.antora.org/antora/latest/standard-directories/ Content classification Systematic usage

    of the include statement modules/ ├── administration-guide │ ├── attachments │ ├── examples │ ├── images │ ├── pages │ ├── partials │ └── nav.adoc
  11. Distributed components https://docs.antora.org/antora/latest/distributed-component-version/ Only editable downstream specific content Only specify

    the component name and version. Once a component specifies in antora.yml an identical component name and version, Antora considers all the files directory sets to belong to the same component version.
  12. Docs as build artifact In the build directory: 1. Antora

    Collector pulls content 2. Antora Assembler creates monolithic AsciiDoc 3. Antora generates the website build/ (unversioned) ├── assembler ├── collector └── site modules/ (versioned in Git) antora-assembler.yml antora-playbook.yml antora.yml
  13. Versioning build artifacts The downstream repository contains: 1. Editable metadata

    2. Non-editable versioned build artifacts pub/ (versioned in Git) ├── administration-guide │ ├── docinfo.html │ ├── images │ └── main.adoc └── user-guide ├── docinfo.html ├── images └── main.adoc
  14. AsciiDoc single-sourcing Custom Attributes :my-attribute: My value {my-attribute} Includes include::document-b.adoc[]

    References: In-Document & Document to Document xref:#section-b[Section B] xref:document-b.adoc#section-b[Section B]
  15. Creating a content pipeline with Antora Antora antora.org Antora Zulip

    Chat chat.antora.org Antora Collector gitlab.com/antora/antora-collector-extension Antora Assembler gitlab.com/antora/antora-assembler Demo Project and more links github.com/ahus1/antora-extensions-demo Alexander Schwartz ahus1.de Fabrice Flore-Thébault themr0c.github.io CC-BY 2.0 Alexander Schwartz and Fabrice Fabrice Flore-Thébault