Skip to main content

Asciidoctor backend for MkDocs

Project description

Getting started

Use AsciiDoc with Material for MkDocs.

[!IMPORTANT] This package is currently in alpha. Features are incomplete, the API may change without notice, and stability is not guaranteed. Use in production environments is not recommended. Feedback and testing are welcome.

This MkDocs plugin replaces the MkDocs default Markdown processor with Asciidoctor for AsciiDoc files, allowing you to write documentation in AsciiDoc while keeping full compatibility with Material for MkDocs.

It runs the Ruby Asciidoctor CLI to render *.adoc files, normalizes the output HTML with BeautifulSoup, and adjusts it to match MkDocs conventions. The plugin ships some CSS/JS/RB and optionally injects "edit this page" links for included AsciiDoc modules when repo_url and edit_uri are configured.

Supports hot reload on the development server for all AsciiDoc source files when writing.

Asciidoctor attributes can be injected via the mkdocs.yml.

Using mkdocs-asciidoctor-backend

pip install mkdocs-asciidoctor-backend --upgrade --pre

[!IMPORTANT]

  • MkDocs expects docs source in a docs/ folder. See Strategy for including docs from repository root for further discussion.

  • For larger doc sets, set up a nav element in the mkdocs.yml, and optionally a root docs/index.adoc file. See nav for more details.

  • xrefs might require you to set relfileprefix either globally in mkdocs.yml or per section/assembly file.

The following example mkdocs.yml can be dropped into the root of an existing AsciiDoc project.

site_name: Example
repo_url: https://github.com/example/repo
repo_name: example-repo
edit_uri: edit/main/

theme:
  name: material
  features:
    - content.action.edit
    - content.code.annotate
    - content.code.copy
    - content.code.select
    - navigation.footer
    - navigation.top
    - navigation.tracking
    - palette.toggle
    - search.highlight
    - search.suggest
    - toc.follow
    - toc.sticky
  palette:
    - scheme: default
      primary: indigo
      accent: indigo
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode
    - scheme: slate
      primary: indigo
      accent: indigo
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode

exclude_docs: |
  partials/**
  snippets/**
  modules/**

plugins:
  - search
  - asciidoctor_backend:
      edit_includes: true
      fail_on_error: false
      ignore_missing: true
      safe_mode: safe
      base_dir: .
      attributes:
        imagesdir: images
        showtitle: true
        sectanchors: true
        sectlinks: true
        icons: font
        idprefix: ""
        idseparator: "-"
        outfilesuffix: .html
        source-highlighter: rouge
        "!toc": "" # Optional: unset the TOC

A demo docs site is published here: https://aireilly.github.io/mkdocs-asciidoctor-backend/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_asciidoctor_backend-0.0.25.tar.gz (185.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_asciidoctor_backend-0.0.25-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_asciidoctor_backend-0.0.25.tar.gz.

File metadata

File hashes

Hashes for mkdocs_asciidoctor_backend-0.0.25.tar.gz
Algorithm Hash digest
SHA256 010868c929011557e16b10569a9a8c57dc0cf20d24998b6993786f21e1189800
MD5 0336d9f0f8af7a25d7964cc8e45ef558
BLAKE2b-256 9cf1224b529057204fdb92dd9d3f1793f78fefff1f07c85832160d8d17657401

See more details on using hashes here.

File details

Details for the file mkdocs_asciidoctor_backend-0.0.25-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_asciidoctor_backend-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 98f1d49be2107a6bbbfd87cf8ecbaaa2c522ae315d2ed51ffa35cca90b20a326
MD5 a53a4a3e8a9f371e6b888aec9d6e3221
BLAKE2b-256 61af079ace6ed8aa0d0261cf911c1eb1b89ed5e79d83888fca6ddcaa08b0cffa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page