CompMD Author's Guide. Written for the @compmd packages at 0.5.0, and following them as they change. Download the book as PDF

CompMD Author's Guide

How to write in CompMD: documents that read as Markdown and render as pages, with boxes, grids, values from data, inputs the reader changes, and components of your own, written in CompMD itself. It is for writers, not programmers: no code is needed. Building CompMD into an application is the Developer's Guide.

The playground's Learn CompMD tour is the five-minute introduction, hands on; this book is what you keep open while writing. Every example in it opens in the playground, where you can change it and watch the page.

Who it is for#

People who write: notes, newsletters, reports, documentation, anything you would write in Markdown and want to do more with. You don't need to program. The book uses a few small formulas, to compute a total or choose a color, and explains each one where it first appears. It covers the syntax, data, inputs, layout, components written in CompMD itself, and the packs a document uses.

Components written in code, in React, Svelte or JavaScript, are the Developer's Guide's subject. So are applications that show CompMD documents. This book says only what such a component looks like to the document that uses it.

Contents#

Part I. Writing

  1. A first document
  2. The Markdown you know
  3. Containers and params
  4. Values and expressions
  5. Showing and repeating

Part II. Data and inputs

  1. Data from files
  2. Inputs the reader changes
  3. Dates, numbers and lists

Part III. Layout

  1. Boxes, rows, stacks and grids
  2. Widths and breakpoints
  3. Placing blocks

Part IV. Components of your own

  1. Definitions
  2. Slots
  3. Template slots
  4. Signatures and fallbacks

Part V. Packs

  1. Using a pack
  2. Code blocks a pack draws
  3. Components in code, in brief

Appendices

  1. The syntax at a glance
  2. The diagnostics and their fixes

The examples#

Each chapter's document is a file in examples/, which the guides' tests process and compare with the chapter's text. Every CompMD block in the book processes without a diagnostic, so what you copy works.