CompMD Developer's Guide
How to build with CompMD: documents people write as text, rendered as pages in your application, with components of your own and from packs, and safe to open from anyone. The spec says what CompMD is; the package READMEs say what each package has; this guide shows how to build with them, from a first page to a published pack. Writing documents themselves is the Author's Guide.
It is written for the @compmd packages at version 0.3.0, and follows them as they change. On the website it is at compmd.hakanserce.com/guides/developers/.
Who it is for#
Developers who put CompMD in an application, or write packs for it. You know JavaScript or TypeScript and a bundler such as Vite. You want to know about the packages, the sandbox and its trust levels, components in React, Svelte or JavaScript, and publishing. You don't need to know CompMD's syntax first: each chapter explains what it uses, and links to the Author's Guide for the rest.
If you write documents rather than code, the Author's Guide is the book for you. The two meet at components: a component written in CompMD is in the Author's Guide, and one written in code is in this guide.
Contents#
Part I. Getting started
Part II. Documents in your app
Part III. Components
- Components and trust
- Packs from npm
- Your app's own components
- The sandbox, closer
- The Developer Tools
Part IV. Writing packs
- Your first pack
- Signatures and params
- React, Svelte and libraries
- Code renderers
- Testing and publishing
Part V. Beyond Vite
Appendices
The examples#
Each chapter's code is a file in examples/, which the guides' tests type-check, build and run in Chrome and WebKit, and compare with the chapter's text, so the code you read is code that works.