# Ord: full syntax reference > Ord is a plain-text outline format: one line is one node, indentation makes the tree, and `key:: value` lines make the outline structured data. This file holds Ord in brief, followed by Parts 1 and 2 of the Ord specification, version 0.7.0-draft, without the tests. Generated from https://ordlang.org/brief.md and the specification at https://github.com/ordlang/ord. Don't edit it by hand. ## Ord in brief Version 0.7.0-draft, 2026-11-22. > Ord is a plain-text outline format. One line is one node, indentation makes the tree, and `key:: value` lines make the outline structured data. Files are UTF-8 text, usually `.txt` in a workspace (a folder with an `Ord.workspace` file) or `.ord` anywhere. This page is enough to read and write Ord correctly. ### Lines and the tree - One line is one node. A child is indented one tab deeper than its parent. - Blank lines don't affect the tree. - List markers at the start of a line (`-`, `*`, `+`, `#`, `1.` followed by a space) are decoration. The node is the same with or without them. - Markdown emphasis (`**bold**`, `_italic_`, `~~strike~~`, `==highlight==`) is formatting, not structure. Links match a label regardless of it. - There are no headings. A node with children is a section. `# Heading` is a node with the label `Heading`; the `#` is a list marker, which editors may draw as a heading. ``` Project Apollo Plan the launch Book the venue Send invitations Budget ``` ### Fields - A **field line** is a key, `::`, a space and a value: `rate:: 1200`. It belongs to the node above it, one level up. - Any key works, spaces included: `Project lead:: Anna`. - `key::` with nothing after it is an empty field. Its child lines are its values. - A line with `::` is a field line: the first `::` splits it into key and value, with or without a space after it, so `due::2026-10-15` is a field too. A `::` inside `[…]`, quotes or backticks doesn't count, and neither does a `;` in a field's value. A single colon is text, so `Note: remember this` is a node. - `;` separates values: `tags:: red; blue`. It only splits field values, never node labels. - An **inline field** sits on the node line in brackets: `Call Anna [due:: 2026-10-15]`. It means the same as a field line under the node. The value runs to the `]`, so it can have spaces: `[note:: two words]`. The key can be several words with single spaces between them, `[due date:: 2026-10-15]`; any other key is quoted, `["Project lead (2026)":: Anna]`. ``` Invoice Acme +invoice period:: 2026-Q3 rate:: 1200 Project lead:: Anna contact:: email:: anna@example.com ``` ### Marks on a node line Marks are shorthand for system fields, whose keys start with `_`. They can be written anywhere on the line; a formatter moves them into this order: list marker, state, label, inline fields, types, ID. Tags, links, URLs and formulas are part of the label and stay where they are written. | Mark | Meaning | Same as | |---|---|---| | `[ ]` `[-]` `[?]` `[x]` | state: new, in progress, waiting, done. Only at the start of the line | `[_state:: done]` | | `+task` | type | `[_types:: task]` | | `#urgent`, `#project/apollo` | tag, nested with `/` | `[_tags:: urgent]` | | `[#Ord notes]` | a tag that is more than a name | `[_tags:: Ord notes]` | | `^t9x1` | ID, one per node | `[_id:: t9x1]` | | `[[Label]]`, `[[t9x1]]`, `[[Label^t9x1]]` | link to another node by label, ID or both | `[_link:: [[Label]]]` | | `https://…`, `./file.pdf`, `[text](url)` | link to a URL or file | `[_url:: …]` | | `=(net * 1.25)` | a computed value | `[_result:: =(net * 1.25)]` | | `@ Label`, `@ Label^t9x1` | a mirror: shows that node here. Only at the start of the line | `[_mirror:: Label]` | | `? +task [ ]` | a search, the only way to write one. Only at the start of the line | the type `search` and `query:: +task [ ]`, never written so | - The **label** is what is left after removing the list marker, state, inline fields, types and ID. Tags, links, URLs and formulas stay in the label. - `@anna` inside a line and `%apollo` are plain text. To refer to a node, link to it, `[[Anna]]`, or use a field whose definition has `options:: +person` (see below). - `C++`, `C#`, `+46`, `#5` and `2 + 2 = 4` are not marks. ``` [x] Send mapping draft to [[Anna]] #urgent [due:: 2026-10-10] +task ^t9x1 ``` State `done`, label `Send mapping draft to [[Anna]] #urgent`, field `due`, type `task`, tag `urgent`, ID `t9x1`. ### Types and references A type is defined by a `+_type` node with a `name` field, in any file, usually the workspace file. Its `fields::` list the type's fields, and a field whose `options` name a type, as `+person`, holds references to nodes of that type: a plain value is enough. ``` Task +_type name:: task fields:: owner:: options:: +person Anna +person Call the venue +task owner:: Anna ``` `owner:: Anna` refers to the node `Anna +person`. Without `options:: +person`, it would be text. - `options:: a; b` lists the values a field is meant to hold. With `tags:: true` as well, an option can be written as a tag on the node: with `options:: bug; feature` and `tags:: true` on an `issue type` field, `Crash +issue #bug` has `issue type:: bug`. - A type's fields are written on its nodes: a tool that adds the type to a node writes each field the node lacks, with the field's `value` as written, and nested field lines under it. Changing a field on the type changes its nodes the same way, except where a node has its own value. A formula in a nested field line sees the node, as `$`. - A field on the type with a formula, `total:: =(a + b)`, is calculated: every node of the type has it, and it is never written on them. Editors show it under the node as `total = 2050`. Don't write it on a node. - `checkbox:: true` on a type definition gives its nodes a checkbox: a tool that adds the type to a node without a state adds `[ ]`. - `nodes::` on a type definition is a template: a tool that adds the type to a node copies the nodes under `nodes::` under it. - A field that several types share is defined once, as a `+_field` node with a `key` field and the field's settings, and listed by its key under each type's `fields::`. It applies on every node that has the field. - A tag's color is set by a `+_tag` node: `Urgent +_tag` with `name:: urgent` and `color:: red` under it. - Names that start with `_` are built in: the system fields, which the marks are short for, such as `_types`, `_id` and `_state`, and the system types `+_type`, `+_tag`, `+_field` and `+_workspace`. Never use a leading `_` for your own field, type, tag or ID: it is the error `M92`. `type::`, `state::` and `id::` are ordinary fields. ### Mirrors and searches - A line `@ Label` is a mirror: it shows the node `Label` in this place without moving it. Add `^id` to name it by ID: `@ Label^t9x1`. Write nothing under a mirror; its children are its source's. - A line `? query` is a search: `? +task [ ]` finds open tasks. Terms are joined by spaces for and, `|` for or, and `!` negates one. ``` Monday @ Send mapping draft^t9x1 ? +task [ ] #urgent Apollo +project [ ] Send mapping draft #urgent +task ^t9x1 ``` ### Value forms A field value that is exactly one of these forms reads as that type. Labels are never read this way. | Form | Examples | Stays text | |---|---|---| | number | `1200`, `-12`, `9.5`, `1e3` | `007`, `+46`, `.5` | | boolean | `true`, `False` | `yes`, `no` | | date | `2026-10-15` | `2026-02-30` (with a warning) | | datetime | `2026-10-15T14:30`, `2026-10-15 14:30`, `2026-10-15T12:30Z` | `2026-10-15T24:00` | | week | `2026-W42` | `2026-W54` | | month | `2026-10` | `2026-13` | Quote a value to keep it text: `"2026-10-15"`. ### JSON Ord maps to JSON and back. What is under a node in Ord is under its label in JSON. | Ord | JSON | |---|---| | fields on the root | `{"client": "Acme", "hours": 6}` | | lines on the root | `["Call Anna", "Book room"]` | | a node with fields and lines | `{"Kickoff": [{"date": "2026-12-01"}, "Book room"]}` | | `tags:: a; b` | `"tags": ["a", "b"]` | | `address::` with `city:: Lund` under it | `"address": {"city": "Lund"}` | | a `rows::` line per record, its fields under it | `"rows": [{"a": 1}, {"a": 3}]` | | index fields `0::`, `1::`, for arrays nothing else holds | `["a", {"b": 2}]` | | `_json:: 5`, as a file's only line | `5` | - A node's array holds its fields first, as one object, then its child lines. A line is always a string. A field value that is a number or boolean is one in JSON, so quote it to keep it text: `code:: "6"`. - Writing Ord from JSON: a field's prose items, three words or more or ending with `.`, `!` or `?`, go on lines under the field; other items go inline. Write `[]` and `{}` as they are, and `null` as `key::`. - `"_ord": "fields"` or `"_ord": "node"` in JSON says how to read `{"x": [...]}` where it could be either. Tools add it only where needed; it is never an Ord field. ### Turning syntax off - `"…"` around a whole key, label or value makes it literal. JSON escapes apply inside: `\"`, `\\`, `\n`. - Backticks around a word or phrase make it literal anywhere, like code in Markdown, and stay in the text: `` `a::b; c` ``. To quote a whole value, use `"`. - A backslash before a mark makes it text: `\#tag`, `\+type`, `\^id`, `\[[x]]`, `\=x`, `\[due:: x]`. - Three or more backticks on their own line open a raw block, closed by as many backticks. Nothing inside is read. - `;` inside a value must be quoted: `title:: "Fish; chips"`. ### Rules for writing Ord 1. Indent with tabs, one per level. 2. Notes, comments and prose about a node are added as child lines under it. 3. Use fields for data points, attributes you would filter or compare on, references, and other structured information that is repeated on several nodes. 4. Write a node's fields before its child nodes. 5. Keep marks in order on the node line: state first, then the label with its `#tags`, then inline fields, `+types`, `^id`. 6. Refer to another node with `[[Label]]`, or with a plain value in a field whose definition has `options:: +type`. To list a node in a second place, use a mirror line `@ Label`, not a line that is only `[[Label]]`. 7. Quote values that contain `;` or start or end with spaces. 8. Don't use Markdown headings or bold for structure; use nesting. ### Right and wrong Prose as a field: ``` Wrong: Meeting with Anna note:: Ask about the budget Right: Meeting with Anna Ask about the budget ``` A colon is not a field: ``` Wrong (a node, not a field): Due: 2026-10-15 Right: due:: 2026-10-15 ``` `::` in prose: ``` Wrong (a field line with the key "Use std"): Use std::vector here Right: Use `std::vector` here ``` ## Ord specification 0.7.0-draft, Parts 1 and 2 ### Part 1: Core Ord #### 1. Data model Reading turns a file into this model, and writing turns the model back into text. The rest of Part 1 says how. ``` Node label Text, empty, or absent (anonymous node) children ordered list of Field and Node Field key text items ordered list of Item list true or false (C16) Item Text or Node Text value the text, with any quotes removed (C21) quoted true or false ``` A label or item records whether it was quoted, since Part 2 reads only unquoted text (L1) and writers treat its trailing whitespace differently (C34). Every model read from text follows C38 to C40. A writer may reject a model that breaks them, since no text expresses it. - **C38.** A field's items are its **inline items**, its text items, then its nodes, then at most one anonymous node (C13). - **C40.** A node is anonymous only as the root (C14) or as the node that holds a field's field children (C13), which holds only fields, at least one. Every other node has a label, which may be empty. #### 2. File - **C49.** A file is UTF-8. Bytes that aren't valid UTF-8 are read as U+FFFD, the replacement character, as the WHATWG UTF-8 decoder reads them, with a warning. An edit leaves the bytes of lines it doesn't touch as they were (C41). - **C1.** Lines end at `\n` or `\r\n`. The last line may have no ending. - **C2.** A BOM at the start of the file is ignored. - **C3.** Only space and tab are whitespace. A **no-break space** (NBSP, U+00A0) is read as a space wherever it appears, so it works as one in the indent, around `::` and `;`, and between forms, and the model has a space in its place. Phone keyboards type it for a space at the end of a line. Any other whitespace character (U+202F, U+3000, vertical tab, form feed, a lone `\r`) is content. A warning is given when one appears at the start of a line or next to `::`. A writer writes a space for an NBSP that was read, so a literal one is kept only as the escape `\u00a0` in a `"` string (C22). A no-break space is read as a space: in the indent, around `::` and `;`, and in text. #### 3. Reading order - **C50.** A reader reads a file in this order. Each step uses only what the steps before it found. 1. Decode the file (C49, C2) and split it into lines (C1). 2. Find the blocks, from the top (C29). A block's lines, opening and closing lines included, are content and skip steps 3 and 4. Going on from the top, find the formulas over several lines (C52), in field values and on node lines, with steps 3 and 4 of their first line; their later lines are content. 3. On every other line, take the indent (C4) and find the spans (C25) and brackets (C51). Then find the separator (C5), which splits the line into key and value (C6 to C8). 4. Unquote the key and a node's label (C21). Split a field's value into items (C15, C16, C19), and unquote each item. 5. Build the tree from the indents (C9, C10), with each block placed by its opening line (C31), and give each field its items (C13). Part 2 reads labels and items after these steps and changes nothing they found. So a quote and a bracket can hide `::` and `;` (both come before the separator), but neither hides a block's delimiters (blocks come first). #### 4. Blocks - **C29.** A line whose text after the indent starts with three or more backticks, its **fence**, and has no backtick after them, opens a **block**. The block ends at the next line whose text after the indent is at least as many backticks as the fence, optionally followed by spaces and tabs. Without such a line, it runs to the end of the file, with a warning. So a block with a longer fence can hold a shorter one, as in Markdown. - **C30.** Lines inside the block, blank ones included, are content. They don't affect the tree and have no key or value. The opening line has no separator. - **C31.** The block is a node, placed in the tree by its opening line (C9). Its label is the block's lines, from the opening line through the closing line, joined with `\n`. Up to as many leading spaces and tabs as the opening line's indent are removed from each line. So the label keeps the fences and any info string, e.g. ```` ```csv ````. The content is raw: no escapes apply. - **C52.** A field's value, or a node line that is only a formula, can hold a formula over several lines, read like a block between its `=(` or `~(` and the matching `)`. A line opens one when it is a field line whose value has an item that starts with `=(` or `~(` (L12, L32) and whose parentheses, counted as C15 counts a formula item's groups, are still open at the end of the line; or when it is a node line whose text after the indent is only such an item (C9), under a field line, under a node or at the root. The formula runs through the first following line where its parentheses close. Those later lines, blank ones included, are content of the value: they don't affect the tree and have no key or value of their own (C30). The value, or the label of the line under a field, is the lines joined with `\n`, each after the first with up to as many leading spaces and tabs removed as the opening line's indent (C31). The rest of the closing line after the `)` is the rest of the value, read as C15 says. A formula whose parentheses never close is not continued: the line is read on its own. A formula after other text in a label ends with its line, so prose such as `Price =(see below` never takes the lines under it. A node whose label is such a formula keeps its child lines, after the closing line. A writer writes a formula item over several lines, an item that is one `=(…)` or `~(…)` closing at its end with a line break inside, and a node whose label is one, as its lines, each at the line's indent, not quoted. #### 5. Quoting and spans - **C21.** The **quote character** is `"`. A **quoted string** is a `"`, content, and a `"`, and the content holds `"` only escaped (C22). A key, label, value or item is **quoted** when it is exactly one quoted string. The quotes are removed and the content is taken literally, whitespace included. Anything else is literal: `"a" and "b"` is unchanged, and so is `'a'`, since `'` is not a quote character. A backtick doesn't quote: `` `a` `` is the text `` `a` ``, backticks included, and only hides what is inside it (C25). - **C22.** Inside `"` quotes, JSON string escapes apply: `\"`, `\\`, `\/`, `\b`, `\f`, `\n`, `\r`, `\t`, `\uXXXX`. A backslash followed by anything else is not an escape: it is kept, with the next character, and gives a warning. `\u` without four hex digits after it is not an escape either. So `"\q"` reads as `\q`. Outside quoted strings, backtick spans included, a backslash is ordinary text in Core. - **C23.** Inside quotes and backtick spans, `::` and `;` are content. - **C24.** Spaces and tabs after a closing quote at the end of a line are ignored. This is the only exception to C8. - **C25.** A **span** hides `::` and `;`: they are content inside it (C5, C15). There are two kinds. - A **backtick span** is a backtick, content without a backtick, and a backtick. A backtick opens one anywhere, and it ends at the next backtick; a backtick without one is ordinary text. It has no escapes, and it always keeps its backticks in the text, even when it is the whole key, label, value or item. It also hides `[` and `]` (C51) and every form of Part 2 (L17). - A **quoted string** (C21) is a span where a key, label, value or item starts: at the start of the text after the indent, right after the separator (C5), or right after a `;` that separates items and the spaces and tabs touching it (C15). It ends at the next `"` that isn't escaped (C22). Anywhere else, and without such an end, `"` is ordinary text. When the span is the whole key, label, value or item, it is quoted (C21); otherwise it keeps its quotes in the text. So `say "hi" now` and `5" screen` are unchanged, `'` never quotes, as in `Anna's`, and `` `a:: b` is a field `` is a node. - **C51.** A **bracket** is a `[` and its matching `]` on the same line, outside spans. Brackets nest, and a backtick span inside one (C25) hides `[` and `]`; `"` is ordinary text there. A bracket hides `::` and `;`: inside it they are content, so they don't separate (C5, C15). A `[` without a matching `]` is ordinary text and hides nothing. A bracket hides nothing from Part 2: links, dates and other forms in it are read. So `Send draft [due:: 2026-10-10]` and `See [[a::b]]` are nodes, `links:: [[a; b]]` has one item, and inline fields (L5) are written in brackets. #### 6. Line - **C4.** The **indent** is the leading spaces and tabs. A line with nothing after its indent is **blank**. - **C5.** The **separator** is the first `::` after the indent that is not inside a span (C25) or a bracket (C51), together with any spaces and tabs touching it. What follows it doesn't matter, so `due::2026-10-10` is a field line, just like `due:: 2026-10-10`: a line that looks like a field is a field. - So a line that is exactly one quoted string is always a node, even when it contains `::`. - **C6.** With a separator, the **key** is the text before it and the **value** is the text after it. - **C7.** Without a separator, the key is empty and the value is all text after the indent. - **C8.** Nothing else is trimmed. Trailing whitespace is part of the value. As a consequence, no value starts with whitespace. #### 7. Tree - **C9.** The parent of a line is the nearest preceding non-blank line with a smaller indent. If there is none, the line is a root. Indent is counted in characters; a tab and a space each count as 1. - **C10.** Blank lines don't affect the tree. #### 8. Fields and nodes - **C11.** A line with a non-empty key is a **field**. A quoted key counts as non-empty even when its content is empty, so `"":: x` is a field. A line with an empty key is a **node**, and its value is the node's **label**. - **C12.** A node's children are its fields and child nodes, in file order. - **C13.** A field's **items** are, in order: the items of its own value (section 9), its node children, and, if it has field children, one **anonymous node** that holds them. An anonymous node has no label. - **C14.** The file is an anonymous root node. Its root lines are the root node's children. #### 9. Items in a field's value - **C15.** In a field's own value, a `;` that is not inside a span (C25) or a bracket (C51) separates items. Spaces and tabs touching a `;` belong to it. In a **formula item**, one that starts with `=` or `~` (L12, L32), a `;` inside a **group** is content too: a `(` outside spans opens a group that ends at its matching `)`, counting nested parentheses and skipping spans and **strings**: a `"` or `'` inside a group starts a string that ends at the next same character not escaped by `\`, as in JSONata. A `(` without a match is ordinary text. So `=$f(a; b); c` has two items, `=($a & "x; y")` one, and `x(a; b)` two, since it is not a formula. - **C16.** Each part between separators, and before and after them, is an item unless it is empty. So an empty value gives no item, `a;;b` has two items, and `a;`, `;a` and `;` have one, one and none. A value with a separator and fewer than two items is a **list**: the field's `list` is true, so `a;` is a list of one item and `;` an empty list, where `a` is one item and an empty value none. A field with two or more items is a list without it. A writer writes a list's `;` after its inline items, as `key:: a;` and `key:: ;`. - **C19.** `;` splits only a field's own value. Node labels are never split. #### 10. Writing - **C41.** A writer either edits a file or writes a model as new text. An **edit** changes only the lines it touches: every other line, blank lines included, stays exactly as written. Every line a writer produces is in **canonical form**, as this section describes. `fmt` rewrites every line of a file in canonical form. - **C26.** A writer quotes a key, label, value or item with `"` quotes (C22), which can hold any text, when it: - is empty, where an empty text must be kept - is a label or item that is quoted in the model (section 1), so it stays quoted and Part 2 still skips it (L1) - starts or ends with whitespace (any Unicode whitespace), except trailing spaces and tabs that C34 drops - starts with `"`, so it would read as quoted (C21) or open a span (C25) - contains a backtick (keys, field values and items), which could otherwise open a span that hides a `::` or `;` written after it (C25); in a formula item (C15), only a span that doesn't close within the item counts - starts with three backticks (keys and labels), which would otherwise open a block (C29), unless C32 applies - contains a newline or another control character, except tab - contains `::` (keys) - contains `[` (keys), which could otherwise open a bracket that hides the `::` written after it (C51) - is a label with a `::` outside spans and brackets (C5, C51) - contains `;` (field values and items), except inside a bracket (C51) or, in a formula item, a group (C15) - contains a `[` without a matching `]` after it (field values and items), which could otherwise pair with a `]` in a later item and hide the `;` between them (C51) - is a key that ends with `:`, which would otherwise merge into the `::` after it - **C27.** Everything else is written bare. - **C47.** Inside `"` quotes, a writer escapes in one canonical form, so equal text is always written the same: - `"` and `\` are written `\"` and `\\`. - Backspace, form feed, newline, carriage return and tab are written `\b`, `\f`, `\n`, `\r` and `\t`. - Other control and format characters, and whitespace other than space, are written `\uXXXX` in lowercase hex, as a surrogate pair above U+FFFF. So NBSP is `\u00a0`. - Everything else is written as is, `/` included. - **C32.** A label that is a block is written as its lines, each with the node's indent, not quoted. A label is a block when its first line is a fence with no backtick after it, its last line would end the block (C29), it has at least two lines, no line in between would end the block, and no line ends with `\r` (C1). - **C42.** A field line is its key, `::`, one space and its inline items (C43): `key:: value`. Without inline items it is `key::`. A field's nodes, and the fields its anonymous node holds, are its child lines (C13). A node with an empty label is written `""` (C26). Only a label that is empty and not quoted in the model is written `::`; a tool that creates a node with an empty label makes the label quoted, `""`, as the JSON mapping does (J11). - **C43.** Inline items are written in order, separated by `;` and a space: `a; b`. - **C44.** Root lines have no indent. In an edit, a new line copies the indent of a sibling next to it. Without one, it gets its parent's indent plus one step. A step is a tab, unless the file is indented only with spaces; then it is the most common difference in indent between a line and its parent. Writing a model and `fmt` indent with one tab per level. - **C45.** A new file uses `\n` line endings, ends with a line ending and has no BOM. An edit keeps the file's line ending, taken from its first line (`\n` if there is none), whether its last line has an ending, and any BOM. `fmt` edits every line (C41), so it keeps them too, and every line gets the file's line ending. - **C46.** Writing a model gives no blank lines. Edits and `fmt` don't add, remove or merge blank lines, but `fmt` removes the spaces and tabs from blank lines outside blocks. - **C48.** In an edit, a new field goes after the node's last field and that field's child lines, or right after the node line when it has no fields. A new child node goes after the node's last child and its child lines. - **C33.** Writing is stable: reading what a writer wrote and writing it again gives the same text. The first write may change how a file is written; a second one changes nothing. - **C34.** A writer drops trailing spaces and tabs from an unquoted label or text item instead of quoting it for them (C26). Otherwise a stray space at the end of a line would quote the text when written, and Part 2 would stop reading it (L1). Quoted text keeps its whitespace. #### 10a. Writing conventions (non-normative) These are recommendations for writers and editors. A file that doesn't follow them is still valid. - **W1.** Write a node's fields before its child nodes. Readers accept them in any order (C12). - **W2.** An editor that cycles a node's state with one command or tap goes `[ ]`, `[-]`, `[?]`, `[x]` and back to `[ ]` (or to no state), by the state's base ([Semantics](https://ordlang.org/spec/semantics) M27): new, in progress, waiting, done. - **W3.** An editor shows a node's label by its state's base: a new node's label as other text, an in-progress node's in a light blue, a waiting node's in a light pink-orange of the same lightness and saturation, and a done node's in gray. Types, tags and other marks keep their own colors. #### 11. Diagnostics - **C35.** A **diagnostic** reports a problem at a position in the file, with a code and a severity. Diagnostics never change how text is read: every file is read into a tree. - **C36.** A **warning** marks text that is read as this spec says but is likely a mistake. An **error** marks text whose meaning the spec can't fully settle, such as two IDs on one node (L8). Core gives only warnings. - **C37.** A **code** is the ID of the rule that gives the diagnostic, followed by `.` and a number when the rule gives more than one. A code is never reused for a different diagnostic. The position is where the diagnostic applies, as listed. | Code | Severity | Given when | Position | |---|---|---|---| | `C3.1` | warning | A whitespace character other than space or tab starts a line's text, after the indent | that character | | `C3.2` | warning | A whitespace character other than space or tab is next to a `::` outside spans, or separated from it only by spaces and tabs | that character | | `C22` | warning | A backslash in `"` quotes is not followed by an escape character | the backslash | | `C29` | warning | A block has no closing line and runs to the end of the file | the opening line's first character after the indent | | `C49` | warning | A line holds bytes that aren't valid UTF-8, once per line | the first character read from them | --- ### Part 2: Label syntax A field can be written in three ways: as a field line (`key:: value`, Part 1), as an inline field in a label (`[key:: value]`), or as a **trigger**, a shortform for an inline field. Part 2 reads inline fields and triggers out of labels and items, and value forms, such as numbers and dates, out of items. It doesn't change Core: labels and items stay strings there, and Part 2 can be applied to them at any time. What the fields mean (single-valued fields, merging, types, references) is in [Semantics](https://ordlang.org/spec/semantics). #### 12. Scope - **L1.** Part 2 reads unquoted node labels and unquoted text items of fields. Quoted labels and items (C21), blocks (C29) and keys are never read. - **L2.** In a label, every form in this part applies. In a field item, only the value triggers apply: `_link`, `_url` and `_result`, mirror values (L31), and value forms (L21). Inline fields and the `_types`, `_id`, `_state` and `_tags` triggers belong to nodes. - **L3.** Unless a rule says otherwise, a form starts at the beginning of the text or right after a space or tab, and ends before the next space or tab or at the end of the text. A **name** is a letter followed by letters, digits, `_` and `-`, or such a name with a `_` before it. Letters are any Unicode letters. A name that starts with `_` is **reserved**: it is how the specs name what is built in, such as the system fields `_types` and `_id` and the system type `_type` ([Semantics](https://ordlang.org/spec/semantics) M11, M53). It is read as any other name, and Semantics M92 makes one that names nothing built in an error, wherever names are written: field keys, types, tags, IDs and the rest. - **L4.** Inline fields and triggers are read wherever they are written on a node line. A writer keeps the line in a fixed order: the list marker (L16), the `_state` trigger, the label (L19), then inline fields, `_types` triggers and the `_id` trigger. It moves forms that are out of place and keeps the written order within each group. To move a form, it cuts the form with the whitespace L19 removes with it, and writes it into its group with one space between it and its neighbours. It edits the line this way rather than building it from the label, so escapes (L18) and other spacing stay as written, and writing stays stable (C33). An inline field for `_types`, `_id` or `_state` whose value can be written as the trigger is written as the trigger, in its group. Links, URLs, formulas and tags stay where they are written, as they are part of the label. An inline `_tags` field stays an inline field, since writing it as a tag would put it in the label. The `_state` trigger is only read at the start (L11), so `[x]` later in a line is text. A line with an inline search (L28) is written as it is: nothing on it is read as a form, so nothing is moved. #### 13. Inline fields - **L5.** `[key:: value]` is an **inline field**: a bracket (C51) that holds a key, `::` and a value. The key is one or more names (L3) separated by single spaces, as in `[due date:: value]`, of which only the first can start with `_`, as a system field's key does (M11), as in `[_types:: task]`; or a quoted string (C21) for any other key, as in `["Project lead (2026)":: value]`. Spaces and tabs around the `::` are allowed. The value is the text after them up to the bracket's closing `]`, without trailing spaces and tabs, so it can hold spaces. It is split into items like a field value (C15 to C20), and is a list as a field's value is (C16): `[x:: a;]` is a list of one item and `[x:: ;]` an empty one. A writer keeps such a field inline rather than as a trigger (L4). An empty value is not an inline field. A quoted value is text and never a reference, even in a reference field; a reference is written as a link. An inline field can start anywhere in a label and ends at its `]`. A `]` in the value needs a matching `[` before it, or goes in backticks. Examples: `[due:: 2026-10-10]`, `[due date:: 2026-10-10]`, `[note:: two words]`, `["Project lead":: anna]`, `[parts:: a; b]`, `[client:: [[Acme Corp]]]`, `[net:: =(gross * 0.8)]`. - **L29.** `[#text]` is short for the inline field `[_tags:: text]`: a bracket (C51) that holds `#`, a letter, and any text up to the bracket's closing `]`, read as the value of L5, so it can hold spaces and `;` splits it into items. It is a way to write a tag that is more than a name (L13), such as `[#Ord notes]`. Like any inline field it can start anywhere and is not part of the label (L19), and a writer keeps it as written. `[#` followed by anything other than a letter is not one, so `[#1]` and `[#]` are text, and `[#text](target)` is a Markdown link (L14). - **L28.** A label that starts with `?` followed by a space or tab, after any list marker (L16), is an **inline search**: it gives the node the type `search` and the inline field `[query:: …]` holding the rest of the label, with the spaces and tabs after `?` removed. It is the only way to write a search: `+search` written as a trigger makes none (Semantics M60). Nothing in the rest is read as a form, so `+task` in it doesn't give the node the type `task`, and the label (L19) is empty. `?` without a space or tab after it, as in `?x` or `??`, is text, as is `?` followed only by spaces and tabs, and `?` later in a line. `\?` is text (L18). What a search means is in [Semantics](https://ordlang.org/spec/semantics) M60. - **L30.** A label that starts with `@`, after any list marker (L16), is a **mirror**: short for the inline field `[_mirror:: …]` holding the rest of the label, with the spaces and tabs after `@` removed, as one item. The item is a reference as written inside `[[` and `]]` (L10): a label, an ID, `Label^id`, `^id` or a quoted label. Nothing in it is read as a form and `;` doesn't split it, so `+task` in it doesn't give the node a type, and the label (L19) is empty. `@` followed only by spaces and tabs is text, as is `@` later in a line, such as after a `_state` trigger. `\@` is text (L18). A writer writes a mirror as its list marker, if any, `@`, one space and its reference. What a mirror means is in [Semantics](https://ordlang.org/spec/semantics) M48. - **L31.** An unquoted text item of a field line or an inline field that starts with `@`, followed by text other than spaces and tabs, is a **mirror value**: a reference to a node, as a link is. The reference is the rest of the item without the spaces and tabs after `@`, read as inside `[[` and `]]` (L10), and nothing in it is read as a form. The item is split from its neighbours at `;` first (C15), so a label with `;` is written as a link. A quoted item such as `"@psu"` is text, as is `@` later in an item. A writer writes a mirror value with no space after `@`, as in `attendees:: @Anna Smith; @Erik`. What it means is in [Semantics](https://ordlang.org/spec/semantics) M21 and M49. - **L32.** `_result` also has a **one-time** form: `~` followed by an expression, read as L12 reads one after `=`, as `~(…)` or, without spaces, `~expr`, in a label, an inline field or a field's item. The value keeps the `~`. So `~$today()`, `~("BE" & $seq(3))` and `~$uuid()` are one-time formulas, and `~` before a space, or inside a word, is text. A tool evaluates it once and writes its result in its place ([Semantics](https://ordlang.org/spec/semantics) M85). #### 14. Triggers - **L6.** A trigger is shortform for an inline field. Triggers exist only for the system fields below ([Semantics](https://ordlang.org/spec/semantics) M11). Each of them holds one form of value, except `_tags`, whose value is ordinary text. | Field | Trigger | Read as | Value | |---|---|---|---| | `_types` | `+task` | `[_types:: task]` | a type name | | `_id` | `^t9x1` | `[_id:: t9x1]` | an ID | | `_link` | `[[Node label]]`, `[[anna-47xu]]`, `[[Node label^anna-47xu]]` | `[_link:: [[Node label]]]`, `[_link:: [[anna-47xu]]]` | a node's label or ID, or both | | `_state` | `[ ]`, `[x]` | `[_state:: new]`, `[_state:: done]` | a state name | | `_result` | `=sum(x)`, `=(a + b)` | `[_result:: =sum(x)]`, `[_result:: =(a + b)]` | an expression | | `_tags` | `#blue`, `#project/apollo`, `[#Ord notes]` (L29) | `[_tags:: blue]`, `[_tags:: project/apollo]`, `[_tags:: Ord notes]` | ordinary text | | `_url` | `https://example.com`, `./spec.pdf` | `[_url:: https://example.com]`, `[_url:: ./spec.pdf]` | a URL or a path | - **L7.** `_types`: `+` followed by a name. `+46`, `C++` and a list marker `+ ` (L16) are not types. - **L8.** `_id`: `^` followed by a name. More than one on a label is an error. - **L10.** `_link`: `[[`, a reference, and a closing `]]`, which is required: without it, the `[[` is text, with a warning. It can start anywhere and ends at the first `]]`. The reference is one of: - `[[Node label]]` or `[[anna-47xu]]`: a label or an ID. It refers to the node with that ID, or else to the node with that label. - `[[Node label^anna-47xu]]`: a label and an ID. The text ends with `^` directly followed by a name, with no space before the ID, the form Tana Paste uses. - `[[^anna-47xu]]`, `[["Node label"]]` and `[["Node label"^anna-47xu]]` are allowed but usually redundant: `^` says the rest is an ID, and quotes (C21) say the text is a label. They settle the case where an ID and a label match different nodes. In a reference field, a plain value is a reference too, without the brackets, and so is a quoted one in a field line, where the quotes mark a label, but not in an inline field (L5). Brackets and `^` are only needed where plain text would otherwise be read as text. Reference fields and how references resolve are in [Semantics](https://ordlang.org/spec/semantics), section 6. - **L11.** `_state`: `[`, one character and a closing `]` at the start of a label, after any list marker (L16), followed by a space, a tab or the end. `[ ]` reads as `new`, `[-]` as `in-progress`, `[?]` as `waiting` and `[x]` as `done`, the built-in states. Any other character is a custom marker, defined by a type's custom state ([Semantics](https://ordlang.org/spec/semantics) M27), and reads as itself, for the index to map to that state. A marker no type defines is a diagnostic. - **L12.** `_result`: `=` followed by an expression: by `(`, or without parentheses by a letter, a digit, `_`, `$`, `!`, `[`, `{`, `"`, `'`, `` ` ``, or `-` and a digit. The value keeps the `=`. `=(…)` ends at the matching `)`, which is required. Without parentheses, the expression has no spaces: it ends before the next space, tab or `;` outside parentheses and quoted strings (JSONata's `"…"`, `'…'` and `` `…` ``), its parentheses must balance, and `.`, `,`, `:`, `?` and `!` at its end are not part of it, as after a URL (L14). So `=$sum(_children.amount)`, `=price*qty`, `=_name`, `=2*x`, `="a"&b` and `=node("i42").total` are formulas wherever `=(…)` is, in a label, an inline field or a field's item, and `=x.` at the end of a sentence is `=x`. `=>`, `==`, `====` and `= 4` stay text, and so does `a=b`, where `=` doesn't start a word (L3). A formula with an `(` that is never closed is text, with a warning, unless it is a field value that continues on the lines after it (C52). `2 + 2 = 4` stays text. What formulas mean is in [Semantics](https://ordlang.org/spec/semantics), section 8. - **L13.** `_tags`: `#` followed by a name, then any number of `/` and a name, for a nested tag such as `#project/apollo`. It ends after its last name, unlike other forms (L3), so punctuation after it is text: `#projectX.` at the end of a sentence is the tag `projectX` and a `.`. `#` followed by a space (a list marker at the start of a label, L16), a digit (`#123`, an issue number) or another `#` is not a tag, and neither is a `#` that doesn't start a form, as in `C#` or a URL. A tag stays in the label (L19). - **L14.** `_url`: a bare URL (a scheme of a letter, then letters, digits, `+`, `-` and `.`, then `://`), a bare path (`./`, `../`, `~/` or `/`, then a character that is neither whitespace nor `/`), or a Markdown link `[text](target)`, which can start anywhere and reads as the target. A target with spaces goes in `<…>`. A bare URL or path doesn't include a trailing `.`, `,`, `;`, `:`, `!`, `?` or `)`. A URL is a value, never a reference to a node. #### 15. Start of a label - **L16.** A list marker at the start of a label is decoration: `-`, `*`, `+` or `#`, or digits followed by `.`, then a space or tab. It is set aside before the rest of this part applies. Writers keep it. Only one is read, so in `- # x` the `#` is part of the label. Editors may draw a `#` line as a heading; it is a list marker like the others, and the node's place in the tree comes from its indent alone. #### 16. Literal text - **L17.** Spans are literal (C25): no form starts inside one. An unmatched quote is plain text. - **L18.** A backslash before the first character of a form makes it plain text: `\+task`, `\^id`, `\#tag`, `\[[x]]`, `\=x`, `\[due:: x]`, `\[#x]`, `\@ x`. Part 2 reads the text without the backslash; Core keeps it. #### 16a. Formatting - **L33.** **Formatting** is Markdown emphasis in a label or a text item, in any flavor: `**bold**`, `__bold__`, `*italic*`, `_italic_`, `~~strike~~`, `==highlight==` and the like. It is formatting, not structure: it reads as no field, the text keeps it as written, and it changes nothing about the tree or how other forms are read. Editors may draw it, or not. Inside a form or a span (L17), such as a link, URL or formula, it is part of that form. - **L34.** Two labels that differ only in formatting are equal wherever labels are compared, as references compare them ([Semantics](https://ordlang.org/spec/semantics) M23). To compare, the delimiters of each pair are removed, outside forms and spans: `**`, `~~` and `==` around text that doesn't start or end with whitespace (or, for `==`, with `=`); `*`, `_` and `__` the same, with no letter, digit or the same character touching them outside; and the backticks of a code span. Pairs are read in that order, may nest, and don't share delimiters. A delimiter without a match stays. So `Ship **v2** now`, `Ship _v2_ now` and `Ship v2 now` are equal, and `snake_case_name` and `2 * 3 * 4` have no formatting. #### 17. Label and items - **L19.** A node's **label** is its line without the list marker, the `_state` trigger, inline fields, and the `_types` and `_id` triggers. A removed form takes the spaces and tabs before it with it, or those after it when only the list marker and removed forms come before it. So `Send +task draft` and `+task Send draft` both have the label `Send draft`. The system field `_label` holds it. Links, URLs, formulas and tags are part of it, where they were written (L4): `Call #anna to decide on budget #projectX +task` has the label `Call #anna to decide on budget #projectX`, and references to it by label (L10) name it by its name, the label without the tags at its end ([Semantics](https://ordlang.org/spec/semantics) M23): `Call #anna to decide on budget`. Editors may render them differently. - **L20.** A field item that is exactly one value trigger (L2), or a mirror value (L31), is that value; trailing spaces and tabs, which the item keeps (C8), don't count, so `=(a * 2) ` is a formula. Any other item is text, and the triggers in it are read as in a label. #### 18. Value forms - **L21.** A text item, of a field or an inline field (L5), that is exactly one of the forms below, trailing spaces and tabs aside (C8), is a value of that form. Value forms are read only there: never in labels, keys or quoted text (L1). The text stays as written; a form is only how it reads. Every other value is of the fallback form `text` (L35). - **L22.** `number`: an optional `-`, then `0` or a digit from 1 to 9 followed by any digits, then optionally `.` and one or more digits, then optionally an exponent: `e` or `E`, an optional `+` or `-`, and one or more digits. This is JSON's number. So `-12`, `0`, `9.5`, `1e3` and `2.5E-7` are numbers, and `007`, `+46`, `1.`, `.5`, `1e` and `1 000` are text. A year such as `2026` is a number. - **L27.** `boolean`: `true` or `false`, in any letter case, so `True` and `FALSE` are booleans too. `yes` and `no` are text, and `1` and `0` are numbers. - **L23.** `date`: `YYYY-MM-DD`, a day that exists in the Gregorian calendar, e.g. `2026-10-15`. - **L24.** `datetime`: a date, then `T` or a space, then `HH:MM`, optionally followed by `:SS` and a fraction of a second after `.`, and optionally an offset: `Z`, or `+` or `-` followed by `HH:MM`. Hours run from 00 to 23, minutes and seconds from 00 to 59. Without an offset, the time is local. E.g. `2026-10-15T14:30`, `2026-10-15 14:30:05` and `2026-10-15T12:30Z`. - **L25.** `week`: `YYYY-Www`, with a week from 01 to 53, e.g. `2026-W42`. `month`: `YYYY-MM`, with a month from 01 to 12, e.g. `2026-10`. Weeks are ISO 8601 weeks, which start on Monday, so a year has a week 53 when it starts on a Thursday, or is a leap year that starts on a Wednesday. - **L35.** `text`: the fallback form, of a value that is none of the forms L22 to L27, quoted text included. So `007`, `yes`, `"true"` and `2026-02-30` are text. Text compares as written, ignoring letter case where a rule says so, as M62 does. - **L26.** Text with the digits and separators of a date, datetime, week or month, but a part out of range, is text, with a warning: `2026-02-30`, `2026-13-01`, `2026-W54`, `2026-10-15T24:00`. #### 19. Diagnostics Codes, severities and positions work as in section 11. | Code | Severity | Given when | Position | |---|---|---|---| | `L8` | error | A label has more than one `_id` trigger | each `_id` trigger after the first | | `L10` | warning | A `[[` has no closing `]]` | the `[[` | | `L11` | warning | A state marker that no type defines | the `[` | | `L12` | warning | A formula has an `(` that is never closed | the `=` | | `L26` | warning | Text has the digits and separators of a date, datetime, week or month, but a part out of range | the text's first character | `L11` needs the types' custom markers ([Semantics](https://ordlang.org/spec/semantics) M27). A reader without type definitions takes them as an option.