Skip to content

The Raspberry Pi 3 as a documentation platform

Set up a complete documentation platform on a Raspberry Pi 3: install Sphinx, generate PDF, HTML, and EPUB from reStructuredText, and manage content with Git.

, 5 min read

Do you need a lot of power to generate professional documentation? With its single gigabyte of RAM and smartphone-like processor, the Raspberry Pi 3 seems fit for an early 2000s office workstation. In practice, however, a computer costing around 40 euros is more than enough to create, manage, and generate documentation in PDF, HTML, or other target formats.

Prerequisites

  • 32 GB class 10 micro-SD card (recommended).
  • Wired or Wi-Fi Internet connection.
  1. Install the Raspberry Pi OS distribution on your Raspberry Pi 3 using Raspberry Pi Imager.

  2. Select Menu ‣ Preferences ‣ Raspberry Pi Configuration.

    The Raspberry Pi Configuration dialog box appears.

  3. Select the Location tab.

  4. Click Set Locale, select the following options, then click OK:

    OptionValue
    Languagefr (French)
    CountryFR
    Character SetUTF-8

    This table shows the default configuration settings for a French-speaking environment:

    • Language: French
    • Country: France
    • Encoding: UTF-8, for optimum compatibility with special and accented characters.
  5. Click Set Keyboard, select the values corresponding to your keyboard, then click OK.

  6. Click OK in the Raspberry Pi Configuration dialog box.

  7. Select Menu ‣ Accessories ‣ Terminal.

  8. Update the system:

    Terminal window
    sudo apt update && sudo apt full-upgrade -y

    Time to read an episode of The Silver Surfer, and the system is updated.

  9. Select Menu ‣ Shutdown ‣ Reboot.

    The Raspberry Pi 3 restarts.

Install the software needed to manage this blog

Section titled “Install the software needed to manage this blog”
  1. Select Menu > Accessories > LXTerminal.

  2. Install the following software packages:

    Terminal window
    sudo apt install -y calibre emacs gitk inkscape python3-sphinx texlive-full

    By the time I’ve read five or six episodes of The Amazing Spider-Man, the following software has been installed:

    SoftwareDescription
    CalibreDigital Book Manager.
    EmacsIntegrated Development Environment.
    GitkDecentralized Version controlRecording every change to a set of files so that any earlier state can be restored, changes can be compared, and several people can work in parallel. Git is the most widely used version-control system; docs-as-code keeps documentation under version control next to the product code.View in glossary → software history browser.
    InkscapeVector drawing software.
    Python SphinxDocumentation generator based on reStructuredTextA plain-text markup language from the Python ecosystem, richer than Markdown (directives, roles, cross-references), and the native source format of the Sphinx documentation generator.View in glossary → format.
    TexliveComplete LaTeX environment for PDF blog generation.
  3. Free up disk space:

    Terminal window
    sudo apt clean
  1. Clone the Git repository of this blog’s sources:

    Terminal window
    git clone https://github.com/olivier-carrere/redaction-technique.org.git
  2. Go to the source directory of this blog:

    Terminal window
    cd redaction-technique.org
  1. Modify a modular source file of this blog using:
    • A text editor:

      Terminal window
      leafpad *coin-du-geek.rst &
    • Emacs:

      Terminal window
      emacs *coin-du-geek.rst &
    • A command-line editor:

      Terminal window
      sed -i "s/directory/folder/g;" *.rst
  1. Modify a diagram source file from this blog using:
    • Vector graphics software:

      Terminal window
      inkscape graphics/modulaire-texte-monolithique-binaire.svg &
    • A command-line editor:

      Terminal window
      sed -i "s/docbook/XML/g;" graphics/*.svg
  1. Start your batch of modifications in Git:

    Terminal window
    git config --global user.email "your email"
    git config --global user.name "your name"
    git add *.rst
    git commit -m "My batch of text modifications"
    git add graphics/*.svg
    git commit -m "My batch of image modifications"
  2. View the modification history of this blog’s sources:

    Terminal window
    gitk &

    O surprise, you’re looking at a GUI! It’s so beautiful, we’re going to take a photo:

    An atomic commit spanning a good fifteen files

    An atomic CommitA recorded snapshot of changes in a Git repository, with an author, a date, and a message explaining the change. Commits form the project history that branches start from and that reviewers and translators compare.View in glossary → spanning a good fifteen files

  1. Return to the terminal, then retrieve the latest tagged version of this blog:

    Terminal window
    git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
  1. Generate the latest tagged version of this blog in PDF, HTML, and EPUB formats:

    Terminal window
    make all
  2. Display the blog in PDF format:

    Terminal window
    xpdf _build/latex/redaction-techniqueorg.pdf &
  3. Display the blog in HTML format:

    Terminal window
    epiphany _build/html/index.html &
  4. Display the blog in EPUB format:

    Terminal window
    ebook-viewer _build/epub/redaction-techniqueorg.epub &

And there you have it. In just a few minutes, you have:

  • Applied Conditional textContent marked as applying only to a given audience, product version, or output, so that one source can be filtered at build time into different deliverables. DITA XML implements it with ditaval files; template engines such as Jinja do the same for text formats.View in glossary → rules to common sources according to publication format. This content is called an e-book in the EPUB version, a document in the PDF version, and something else in the HTML version.
  • Generated, in three different formats, a 60-page documentation including some 40 diagrams.

The Raspberry Pi 3 is an entirely credible documentation platform, provided you do without, or almost without, a graphical interface!

The next tests will be to generate the DITA XMLA structured, modular XML authoring architecture built around the concept/task/reference typology and content reuse via conrefs and ditamaps.View in glossary → version of this blog, and to generate the blog on a smartphone by installing a Linux distribution on Android.