Skip to main content

mr note-block create

Create a new block attached to a Note. --note-id and --type are required, and --content matters more than its default suggests: the CLI sends {} when the flag is omitted, so the server validates and stores that rather than substituting the type's own default content. text and heading reject an empty object (text block content must have a 'text' field, heading level must be 1-6); the other built-in types accept it and are then created empty. The exact content shape depends on the chosen type; see note-block types for the default content schema of each built-in type.

--position is optional; when omitted the server assigns a position after the current last block. A text block that sorts first on the note is kept in sync with the note's description: creating one rewrites the description, and creating an empty one adopts the description as its text. The created record is returned; capture .id from JSON output for use in follow-up commands.

Usage

mr note-block create

Examples

Create a text block on note 42

mr note-block create --note-id 42 --type text --content '{"text":"hello"}'

Create a heading block with an explicit position

mr note-block create --note-id 42 --type heading --content '{"text":"Intro","level":2}' --position a

Flags

FlagTypeDefaultDescription
--note-iduint0Note ID (required) (required)
--typestring``Block type (required) (required)
--contentstring{}Block content JSON
--positionstring``Block position

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

Created NoteBlock object with id (uint), noteId (uint), type (string), position (string), content (object), state (object), createdAt (RFC3339), updatedAt (RFC3339)

Exit Codes

0 on success; 1 on any error

See Also