Contribute

Edit this documentation

Translate the documentation or open the complete project on your computer.

Nothing is published until you choose to submit your work.

Code and terminal

Commands, source explanations, diffs, and API endpoints.

Terminal

The terminal distinguishes commands, comments, and output. Set the prompt and comment characters in metadata. The copy button copies executable commands only. It does not copy prompt characters, complete comment lines, or command output. Set title and frame (macos, windows, linux, or plain) as metadata.

Build the documentation
# Check the site before the production build.
$ mpress check
No issues found.
$ mpress build --strict
Built 15 pages in 24ms.
Source
md
@terminal{title="Build the documentation" frame="macos" prompt="$" comment="#"}
# Check the site before the production build.
$ mpress check
No issues found.
$ mpress build --strict
Built 15 pages in 24ms.
@end

D2 diagrams

Use a d2 fence to render a diagram as an SVG image during the build:

text
Frontend -> Backend: Call service
Backend -> Database: Query
Frontend, Backend, Database

The SVG includes its fonts and works without JavaScript, a diagram service, or a separate D2 installation. M-Press uses the Dagre layout engine. Keep each diagram self-contained: file imports are disabled. Invalid D2 fails the build and reports the compiler error instead of displaying the source as code. Add title="Description of the diagram" after d2 in the opening fence to provide alternative text. Without a title, the diagram’s node labels are used. Wide diagrams scroll within their frame so their text remains readable.

Diffs

mpress.yaml
− colorScheme: light− search: false+ colorScheme: system+ search: true
Source
md
@diff{title="mpress.yaml" mode="inline"}
colorScheme: light
search: false
---
colorScheme: system
search: true
@end

Use the default mode="side-by-side" for a two-column comparison.

Explained code

func main() {    site.Build()}

1The program starts with a regular Go entry point.

2One call turns the content tree into the static site.

Source
md
@explained
```go
func main() { // (1)
    site.Build() // (2)
}
```

(1) The program starts with a regular Go entry point.

(2) One call turns the content tree into the static site.
@end

Point to or focus a numbered code line to open its explanation. Select the line on a touch screen.

API endpoints

POST /v1/builds

Creates a documentation build.

Field Type Required
ref string yes
strict boolean no
Source
md
@api{method="POST" path="/v1/builds"}
Creates a documentation build.

| Field | Type | Required |
| --- | --- | --- |
| `ref` | string | yes |
| `strict` | boolean | no |
@end

Last updated: