build: 192ms run: 2ms

Anatomy of a devcard

A devcard is produced by running a devcard-producing function. Such a function must satistfy the following criteria:

For example:

func DevcardAnatomy(dc *devcard.Devcard) {
	dc.SetTitle("Anatomy of a devcard")

	// ...
}

All devcard-producing functions defined in your code will be collected in the devcards list in order of appearance.

Devcard’s content

A devcard is essentially a list of cells. Some cells are rendered as paragraphs of text, others as code blocks or images. Here are the first four cells of this very devcard:

func DevcardAnatomy(dc *devcard.Devcard) {
	dc.SetTitle("Anatomy of a devcard")

	dc.Md("A devcard is produced by running a devcard-producing function. ",
	"Such a function must follow the following criteria:\n",
	"* Its name begins with `Devcard`.\n",
	"* It takes a single argument, which is a pointer to `devcard.Devcard`.\n",
	"* It returns nothing.\n")
	
	dc.Md("For example:")
	dc.Mono(devcard.WithHighlighting("go"),
	`func DevcardAnatomy(dc *devcard.Devcard) {
		dc.SetTitle("Anatomy of a devcard")
	
	// ...
}`)

	dc.Md("All devcard-producing functions defined in your code will be collected in the [devcards list](/dc/devcard-examples) in order of appearance.")

The next four devcards describe various types of cells in detail. You are encouraged to play with them as you go along, perhaps using this devcard as a scratch pad.

❬ prev: Getting started | top: examples | next: Text cells ❭