docspec/README.org

2.8 KiB

DocSpec and DocWarp

DocSpec provides a standard, predictable interface to access the four different types of documentation for a project, as defined by the Diataxis Framework -

  1. tutorials (lessons),
  2. how-to guides (recipes),
  3. explanation (discussion), and
  4. reference (technical description)

DocSpec is

  1. a configuration file in your project root, specifying how to reach sections of your documentation, and associating symbols with them if desired
  2. a Common Lisp library to query the file

DocWarp is

  1. a command line client (using DocSpec) to view the desired documentation for a project, in your preferred programs and formats
  2. an Emacs frontend to the same, providing a completing-read interface

It is hoped that these tools will

  1. make documentation more accessible to users
  2. make more projects aware of the Diataxis Framework, and incentivize them to structure their documentation according to its suggestions, which in turn would make their documentation easier to read, write, and maintain.

Explanation

The DocSpec format

Below is what an example DocSpec file for the McCLIM project might look like.

Each DocSpec file can list up to four types of documentation as symbols - tutorial, howto, explanation, and reference.

Each documentation type has topics it covers, e.g. first-attempt. In this example, each topic is a symbol, but they could also be strings. Documentation written in accordance with the Diataxis Framework is more likely to cover the same topics in different sections, so topics may be repeated between documentation types, but not within.

The documentation for each topic can be presented in one or more formats - a string, a PDF file, an HTML file, etc.

((tutorial
  (first-attempt     (:pdf "<url>") (:html "<url>"))
  (defining-commands (:pdf "<url>") (:html "<url>"))
  ...)
 (howto
  (create-text-editor-pane    (:pdf "<url>") (:html "<url>"))
  (run-app-in-separate-thread (:pdf "<url>") (:html "<url>"))
  (create-new-backend         (:pdf "<url>") (:html "<url>"))
  ...)
 (explanation
  (coordinate-systems  (:pdf "<url>") (:html "<url>"))
  (sheet-hierarchies   (:pdf "<url>") (:html "<url>"))
  (development-history (:pdf "<url>") (:html "<url>"))
  ...)
 (reference
  (redisplay       (:pdf "<url>") (:html "<url>"))
  (layout-protocol (:pdf "<url>") (:html "<url>"))
  (output-protocol (:pdf "<url>") (:html "<url>"))
  ...))

Tools making use of DocSpec can offer commands such as view-tutorial, view-howto, view-explanation, and view-reference. Users can configure a priority list for their preferred formats; if the package does not offer documentation in any of those formats, the tool could prompt them to select an available format.