Ord specification
Version 0.7.0-draft, 2026-11-22.
Introduction
Ord is a plain-text outline format. Each line is a node or a field, indentation makes the tree, and fields make the outline structured data. This spec says how text is read into a tree, how a tree is written back as text, and how the shortform for system fields is read out of labels.
The spec has three parts:
- Part 1, Core Ord. The syntax and the data model: everything a parser and a writer need.
- Part 2, Label syntax. Inline fields and triggers, the shortform for system fields such as
+type,#tag,^idand[x], read out of labels and items, and value forms such as numbers and dates. Core doesn't depend on it. - Part 3, Files. Which files are Ord: workspaces,
.txtand.ord, and their types.
Companion documents build on it:
- Test format. The AST dump that tests compare against, and how the examples in the specs are written, so a script can extract and run them.
- Semantics. What fields mean across a workspace (types, references, states, single-valued fields), formulas and queries.
- JSON mapping and CSV mapping. Mappings to other formats, built on the data model.
- Grammar. ABNF for the pieces a line is made of, and one way to read a file in linear time (non-normative).
- Changelog. What changed in each version.
Design goals
These goals are informative. They explain the rules and decide new ones.
- Plain text first. A file is readable and editable in any editor. Tools add power but are never needed to read it.
- Every file reads. There are no syntax errors. Every file is read into a tree, and anything doubtful is a diagnostic (C35).
- Punctuation decides. Whether a line is a field or a node, and where its key, value and items are, is decided by
::,;, quotes and indentation, never by words or letter case. - Lines read on their own. A line's key, value and inline items depend only on that line, except inside a block or a formula over several lines (C52). Nothing in Core depends on other files or an index. Part 2 takes the one fact it needs from types, their custom state markers, as an option.
- Quoting turns syntax off. Any text can be written literally by quoting it with
". Backticks mark a literal part of a text, as code does in Markdown, and stay in it. - Writing is stable. Writing twice changes nothing (C33), and an edit leaves the lines it doesn't touch as they were (C41).
- Light syntax. Single symbols and rules that let prose stay prose, instead of heavy delimiters.
Conventions
- S1. Rules are plain statements, and every rule is required unless its section is marked non-normative. "May" says what is allowed: a form a file can have, or a choice an implementation has. Sentences that start with "So" spell out what the rules already imply.
- S2. Every rule has an ID: a letter for where it belongs (
CCore,Llabel syntax,Ddump,Ttests,Wwriting conventions,Ffiles,Sthis front matter) and a number. Companion specs use their own letters, such asJ. IDs are given in the order rules are added, so they don't follow the order of the text. An ID never changes and is never reused. A removed rule is deleted, and its ID is listed as retired in the changelog. - S3. A character is a Unicode code point. Whitespace means space or tab, and a no-break space is read as a space (C3). A letter is a Unicode letter (general category L), and a digit is 0 to 9. Positions count characters (D9).
- S4. Code spans show text exactly. In examples,
→stands for a tab and␣for a space where one would be invisible (T3). - S5. Grammars use ABNF (RFC 5234), where a string in double quotes matches any letter case and
%s"…"matches it exactly (RFC 7405). Where a grammar and the prose differ, the prose wins. - S6. Tests (Test format, part B) are normative, like rules. A test that disagrees with a rule is a bug in the spec, fixed by changing one of them. Other examples are informative.
- S10. The spec's version is
major.minor.patch. From 1.0.0, a change that can make a file read or write differently raises the major version, a change that only adds, such as a diagnostic or a test for what the rules already say, raises the minor version, and a change to wording raises the patch. Before 1.0.0, any change can make a file read differently and raises the minor version, and wording raises the patch. The specs in this set (this one and its companions) share one version, and a version can carry a pre-release suffix such as-draft. Each version has an entry in the changelog that names the rules it changed. Changes since the last version are listed there as unreleased until the next version.
Conformance
- S7. There are three conformance classes:
- A reader reads any file into the data model as Part 1 says, with source ranges (Test format A3), and reports every diagnostic in section 11.
- A writer is a reader that also writes, edits and formats files as section 10 says.
- A label reader is a reader that also applies Part 2 and reports every diagnostic in section 19.
- S8. An implementation conforms to a class, in a version of the spec, when it passes that class's tests in that version and follows its rules where no test covers them. Reader tests have neither the
fmtnor thelabelsoption. Writer tests havefmt, and every input is also checked for stable writing (T5). Label reader tests havelabels. - S9. Companion specs define their own classes, such as a JSON mapper and a CSV mapper.
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
\nor\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\u00a0in a"string (C22).
⟨U+FEFF⟩a:: b⟨U+000D⟩
⟨U+3000⟩c
d⟨U+3000⟩:: e
f:: lone⟨U+000D⟩cr
.
root
field "a"
"b"
node "\u3000c"
field "d\u3000"
"e"
field "f"
"lone\rcr"
! C3.1 2:1
! C3.2 3:2
A no-break space is read as a space: in the indent, around :: and ;, and in text.
Tasks
⟨U+00A0⟩⟨U+00A0⟩Call⟨U+00A0⟩Anna
a⟨U+00A0⟩::⟨U+00A0⟩x⟨U+00A0⟩;⟨U+00A0⟩y
.
root
node "Tasks"
node "Call Anna"
field "a"
"x"
"y"
Open slot #hej⟨U+00A0⟩+hej⟨U+00A0⟩^hej
.
root
node "Open slot #hej +hej ^hej"
label "Open slot #hej"
field "_tags" embedded
"hej"
field "_types" inline
"hej"
field "_id" inline
"hej"
3. Reading order
C50. A reader reads a file in this order. Each step uses only what the steps before it found.
- Decode the file (C49, C2) and split it into lines (C1).
- 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.
- 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).
- Unquote the key and a node's label (C21). Split a field's value into items (C15, C16, C19), and unquote each item.
- 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.
Notes
→```js
→␣␣a:: b
→
→```
"x
````md
```
it's raw \n
```
````
'''
.
root
node "Notes"
node "```js\n a:: b\n\n```"
node "\"x"
node "````md\n```\nit's raw \\n\n```\n````"
node "'''"
- 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 asPrice =(see belownever 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.
Inv
→total:: =(
→→$sum(x)
→); 4
→sub::
→→=(1 +
→→␣␣2)
→note:: sad =(
→Total =(
→→1)
→=(2 *
→→3)
→→kid
.
root
node "Inv"
field "total"
"=(\n\t$sum(x)\n)"
"4"
field "sub"
node "=(1 +\n 2)"
field "note"
"sad =("
node "Total =("
node "1)"
node "=(2 *\n\t3)"
node "kid"
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.\uwithout 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" nowand5" screenare unchanged,'never quotes, as inAnna's, and`a:: b` is a fieldis a node.- 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
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. SoSend draft [due:: 2026-10-10]andSee [[a::b]]are nodes,links:: [[a; b]]has one item, and inline fields (L5) are written in brackets.
Send draft [due:: 2026-10-10]
See [[a::b]] now
a [b [c:: d] e:: f] g:: h
a [b:: c
[x] Call:: Anna
links:: [[a; b]]; c
note:: Call [due:: x; y]
d:: a [b; c
.
root
node "Send draft [due:: 2026-10-10]"
node "See [[a::b]] now"
field "a [b [c:: d] e:: f] g"
"h"
field "a [b"
"c"
field "[x] Call"
"Anna"
field "links"
"[[a; b]]"
"c"
field "note"
"Call [due:: x; y]"
field "d"
"a [b"
"c"
a:: ""
b:: " hello"
c:: "x; y"
d:: "line 1\nline 2"
e:: "\"Hi\""
f:: 'x; y'
g:: `C:\temp`
h:: say "hi" now
.
root
field "a"
quoted ""
field "b"
quoted " hello"
field "c"
quoted "x; y"
field "d"
quoted "line 1\nline 2"
field "e"
quoted "\"Hi\""
field "f"
"'x"
"y'"
field "g"
"`C:\\temp`"
field "h"
"say \"hi\" now"
a:: "x"␣␣
b:: "\q"
c:: x "a;b" y; z
d:: "a:: b; c"
e:: x `a;b` y; z
.
root
field "a"
quoted "x"
field "b"
quoted "\\q"
field "c"
"x \"a"
"b\" y"
"z"
field "d"
quoted "a:: b; c"
field "e"
"x `a;b` y"
"z"
! C22 2:6
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, sodue::2026-10-10is a field line, just likedue:: 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
::.
- 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.
a :: b
a:: b::c
a::b
Send draft due::2026-10-10
a::;
hello
:: hello
a::␣␣␣
.
root
field "a"
"b"
field "a"
"b::c"
field "a"
"b"
field "Send draft due"
"2026-10-10"
field "a" list
node "hello"
node "hello"
field "a"
The quick brown fox jumps over the lazy dog and keeps on running:: x
Note:: the key's length doesn't matter
.
root
field "The quick brown fox jumps over the lazy dog and keeps on running"
"x"
field "Note"
"the key's length doesn't matter"
"a::b":: c
"a::b"
`a:: b` is a field
Anna's key:: Erik's value
.
root
field "a::b"
"c"
node quoted "a::b"
node "`a:: b` is a field"
field "Anna's key"
"Erik's value"
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.
Project
→Task one
→→due:: 2026-10-20
␣␣
→Task two
␣␣Mixed indent child
Second root
.
root
node "Project"
node "Task one"
field "due"
"2026-10-20"
node "Task two"
node "Mixed indent child"
node "Second root"
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
"":: xis 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.
"":: x
Note; with semicolon
k:: x
→Anna
→primary:: anna
→Erik
m:: a;;
;
→a
→b:: c
.
root
field ""
"x"
node "Note; with semicolon"
field "k"
"x"
node "Anna"
node "Erik"
node
field "primary"
"anna"
field "m" list
"a"
node ";"
node "a"
field "b"
"c"
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); chas two items,=($a & "x; y")one, andx(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;;bhas two items, anda;,;aand;have one, one and none. A value with a separator and fewer than two items is a list: the field'slistis true, soa;is a list of one item and;an empty list, whereais 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, askey:: a;andkey:: ;. - C19.
;splits only a field's own value. Node labels are never split.
a::
b:: anna
c:: anna;
d:: anna; oscar
e:: a;;b
f::;
g:: ;;a
h:: a\;b; c
i:: `a;b`; c
.
root
field "a"
field "b"
"anna"
field "c" list
"anna"
field "d"
"anna"
"oscar"
field "e"
"a"
"b"
field "f" list
field "g" list
"a"
field "h"
"a\\"
"b"
"c"
field "i"
"`a;b`"
"c"
a:: =$f(a; b); c
b:: =($a & ')'; $b)
c:: x(a; b)
d:: =f(a; b
e:: =(a\;b)
f:: =($a & "x; y"); z
.
root
field "a"
"=$f(a; b)"
"c"
field "b"
"=($a & ')'; $b)"
field "c"
"x(a"
"b)"
field "d"
"=f(a"
"b"
field "e"
"=(a\\;b)"
field "f"
"=($a & \"x; y\")"
"z"
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.
fmtrewrites 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,\rand\t. - Other control and format characters, and whitespace other than space, are written
\uXXXXin 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 iskey::. 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
fmtindent with one tab per level. - C45. A new file uses
\nline endings, ends with a line ending and has no BOM. An edit keeps the file's line ending, taken from its first line (\nif there is none), whether its last line has an ending, and any BOM.fmtedits 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
fmtdon't add, remove or merge blank lines, butfmtremoves 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.
a :: x ;y;; z
b::;
c :: "plain"
Send→draft→+task␣␣
␣␣
f::
g:: "tab→here"
h:: "nb\u00A0sp"
.
a:: x; y; z
b:: ;
c:: "plain"
Send→draft→+task
f::
→g:: "tab\there"
→h:: "nb\u00a0sp"
Notes
␣␣```
␣␣x
␣␣␣␣y
␣␣```
.
Notes
→```
→x
→␣␣y
→```
k:: x;
"a:b:":: v
Key:: ends with \
::
"Label: with:: sep"
'single'
a:: say `hi`; "x
b:: x [y; z
c:: [[a; b]]; d
`code`
.
k:: x;
"a:b:":: v
Key:: ends with \
::
"Label: with:: sep"
'single'
a:: "say `hi`"; "\"x"
b:: "x [y"; z
c:: [[a; b]]; d
`code`
⟨U+FEFF⟩a :: b⟨U+000D⟩
c:: d
.
⟨U+FEFF⟩a:: b⟨U+000D⟩
c:: d⟨U+000D⟩
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 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.
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,_urland_result, mirror values (L31), and value forms (L21). Inline fields and the_types,_id,_stateand_tagstriggers 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_typesand_idand the system type_type(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
_statetrigger, the label (L19), then inline fields,_typestriggers and the_idtrigger. 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,_idor_statewhose 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_tagsfield stays an inline field, since writing it as a tag would put it in the label. The_statetrigger 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.
+task Send draft [due:: 2026-10-20] #urgent [x] ^s1
- [x] Done +b #a
Plan [_types:: task] [_tags:: x]
Ship [_state:: done]
.
Send draft #urgent [x] [due:: 2026-10-20] +task ^s1
- [x] Done #a +b
Plan [_tags:: x] +task
[x] Ship
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)].
Meet [due date:: 2026-10-21] [_types:: task] [Project lead:: anna]
Not fields: [two spaces:: x] and [1 day:: y]
.
root
node "Meet [due date:: 2026-10-21] [_types:: task] [Project lead:: anna]"
label "Meet"
field "due date" inline
"2026-10-21" date
field "_types" inline
"task"
field "Project lead" inline
"anna"
node "Not fields: [two spaces:: x] and [1 day:: y]"
- 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).
Plan [#Ord notes] now +task
Also [#a; b c]
[#x](https://example.com) and [#1]
.
root
node "Plan [#Ord notes] now +task"
label "Plan now"
field "_tags" inline
"Ord notes"
field "_types" inline
"task"
node "Also [#a; b c]"
label "Also"
field "_tags" inline
"a"
"b c"
node "[#x](https://example.com) and [#1]"
field "_url" embedded
"https://example.com"
- 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 typesearchand 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:+searchwritten as a trigger makes none (Semantics M60). Nothing in the rest is read as a form, so+taskin it doesn't give the node the typetask, and the label (L19) is empty.?without a space or tab after it, as in?xor??, 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 M60.
? [ ] +task @anna
- ? #urgent
?x and ? alone
\? not a search
.
root
node "? [ ] +task @anna"
label ""
field "_types" inline
"search"
field "query" inline
"[ ] +task @anna"
node "- ? #urgent"
label ""
field "_types" inline
"search"
field "query" inline
"#urgent"
node "?x and ? alone"
node "\\? not a search"
label "? not a search"
- 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,^idor a quoted label. Nothing in it is read as a form and;doesn't split it, so+taskin 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_statetrigger.\@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 M48.
@ Send mapping draft^t9x1
- @Apollo +project
@→
[x] @ not a mirror
\@ Erik
.
root
node "@ Send mapping draft^t9x1"
label ""
field "_mirror" inline
"Send mapping draft^t9x1"
node "- @Apollo +project"
label ""
field "_mirror" inline
"Apollo +project"
node "@\t"
label "@"
node "[x] @ not a mirror"
label "@ not a mirror"
field "_state" inline
"done"
node "\\@ Erik"
label "@ Erik"
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 inattendees:: @Anna Smith; @Erik. What it means is in Semantics M21 and M49.L32.
_resultalso 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 M85).
attendees:: @Anna Smith; @ Erik; "@quoted"
see:: [[Anna]] and @Erik
- Meet [with:: @Anna]
.
root
field "attendees"
"@Anna Smith" _mirror
"@ Erik" _mirror
quoted "@quoted"
field "see"
"[[Anna]] and @Erik"
field "_link" embedded
"[[Anna]]"
node "- Meet [with:: @Anna]"
label "Meet"
field "with" inline
"@Anna" _mirror
@Apollo
- @→Erik Berg
meeting:: @ Anna Smith; @Erik
.
@ Apollo
- @ Erik Berg
meeting:: @Anna Smith; @Erik
14. Triggers
- L6. A trigger is shortform for an inline field. Triggers exist only for the system fields below (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, 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 asnew,[-]asin-progress,[?]aswaitingand[x]asdone, the built-in states. Any other character is a custom marker, defined by a type's custom state (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"&band=node("i42").totalare 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= 4stay text, and so doesa=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 = 4stays text. What formulas mean is in 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 tagprojectXand 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 inC#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- # xthe#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.
# Heading +task
- # Not a second marker
#tag starts the label
.
root
node "# Heading +task"
label "Heading"
field "_types" inline
"task"
node "- # Not a second marker"
label "# Not a second marker"
node "#tag starts the label"
field "_tags" embedded
"tag"
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 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. SoShip **v2** now,Ship _v2_ nowandShip v2 noware equal, andsnake_case_nameand2 * 3 * 4have no formatting.
If _you_ use **Markdown**, you ~~don't~~ ==re-learn== much
.
root
node "If _you_ use **Markdown**, you ~~don't~~ ==re-learn== much"
17. Label and items
- L19. A node's label is its line without the list marker, the
_statetrigger, inline fields, and the_typesand_idtriggers. 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. SoSend +task draftand+task Send draftboth have the labelSend draft. The system field_labelholds it. Links, URLs, formulas and tags are part of it, where they were written (L4):Call #anna to decide on budget #projectX +taskhas the labelCall #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 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.
- [-] Buy milk +errand #urgent ^m1lk
+task Call Anna
1. Price +46, C++, C#, #5 and # heading
Two ids ^a1 ^b2
[ ] Call back
[?] Ask Erik
+ [x] Read the spec
.
root
node "- [-] Buy milk +errand #urgent ^m1lk"
label "Buy milk #urgent"
field "_state" inline
"in-progress"
field "_types" inline
"errand"
field "_tags" embedded
"urgent"
field "_id" inline
"m1lk"
node "+task Call Anna"
label "Call Anna"
field "_types" inline
"task"
node "1. Price +46, C++, C#, #5 and # heading"
label "Price +46, C++, C#, #5 and # heading"
node "Two ids ^a1 ^b2"
label "Two ids"
field "_id" inline
"a1"
field "_id" inline
"b2"
node "[ ] Call back"
label "Call back"
field "_state" inline
"new"
node "[?] Ask Erik"
label "Ask Erik"
field "_state" inline
"waiting"
node "+ [x] Read the spec"
label "Read the spec"
field "_state" inline
"done"
! L8 4:13
Call #anna to decide on budget #projectX. +task
Nested #project/apollo, #a/ and #b-2/c
Not tags: #123 # C# ##x \#y and #
.
root
node "Call #anna to decide on budget #projectX. +task"
label "Call #anna to decide on budget #projectX."
field "_tags" embedded
"anna"
field "_tags" embedded
"projectX"
field "_types" inline
"task"
node "Nested #project/apollo, #a/ and #b-2/c"
field "_tags" embedded
"project/apollo"
field "_tags" embedded
"a"
field "_tags" embedded
"b-2/c"
node "Not tags: #123 # C# ##x \\#y and #"
label "Not tags: #123 # C# ##x #y and #"
Plan [due:: 2026-10-20] ["Project lead":: anna] [parts:: a;b] [note:: "two words"] [memo:: two words]
\#literal and \[due:: x] and `#code` here
"Quoted +task label"
#key:: +task #x
who:: [[Anna]]
See https://example.com/a. and ./spec.pdf, not //x
Total =(a + b) then =sum(x
Broken [[link
Sum =$sum(x)*2. Not => or ==
.
root
node "Plan [due:: 2026-10-20] [\"Project lead\":: anna] [parts:: a;b] [note:: \"two words\"] [memo:: two words]"
label "Plan"
field "due" inline
"2026-10-20" date
field "Project lead" inline
"anna"
field "parts" inline
"a"
"b"
field "note" inline
quoted "two words"
field "memo" inline
"two words"
node "\\#literal and \\[due:: x] and `#code` here"
label "#literal and [due:: x] and `#code` here"
node quoted "Quoted +task label"
field "#key"
"+task #x"
field "who"
"[[Anna]]" _link
node "See https://example.com/a. and ./spec.pdf, not //x"
field "_url" embedded
"https://example.com/a"
field "_url" embedded
"./spec.pdf"
node "Total =(a + b) then =sum(x"
field "_result" embedded
"=(a + b)"
node "Broken [[link"
node "Sum =$sum(x)*2. Not => or =="
field "_result" embedded
"=$sum(x)*2"
! L12 7:21
! L10 8:8
Call Anna about [[Acme Corp]] +task [client:: [[Acme Corp]]] [due:: 2026-10-20]
See [[anna-47xu]], [[Anna Smith^anna-47xu]] and [[^x1]]
client:: [[Acme Corp]]; see [[Globex]] now
.
root
node "Call Anna about [[Acme Corp]] +task [client:: [[Acme Corp]]] [due:: 2026-10-20]"
label "Call Anna about [[Acme Corp]]"
field "_link" embedded
"[[Acme Corp]]"
field "_types" inline
"task"
field "client" inline
"[[Acme Corp]]" _link
field "due" inline
"2026-10-20" date
node "See [[anna-47xu]], [[Anna Smith^anna-47xu]] and [[^x1]]"
field "_link" embedded
"[[anna-47xu]]"
field "_link" embedded
"[[Anna Smith^anna-47xu]]"
field "_link" embedded
"[[^x1]]"
field "client"
"[[Acme Corp]]" _link
"see [[Globex]] now"
field "_link" embedded
"[[Globex]]"
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-, then0or a digit from 1 to 9 followed by any digits, then optionally.and one or more digits, then optionally an exponent:eorE, an optional+or-, and one or more digits. This is JSON's number. So-12,0,9.5,1e3and2.5E-7are numbers, and007,+46,1.,.5,1eand1 000are text. A year such as2026is a number. - L27.
boolean:trueorfalse, in any letter case, soTrueandFALSEare booleans too.yesandnoare text, and1and0are numbers. - L23.
date:YYYY-MM-DD, a day that exists in the Gregorian calendar, e.g.2026-10-15. - L24.
datetime: a date, thenTor a space, thenHH:MM, optionally followed by:SSand a fraction of a second after., and optionally an offset:Z, or+or-followed byHH: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:05and2026-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. So007,yes,"true"and2026-02-30are 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.
a:: -12; 0; 9.5; 2026; 1e3; 2.5E-7
b:: 007; +46; 1.; .5; 1e
c:: 2026-10-15; 2026-W42; 2026-10
d:: 2026-10-15T14:30; 2026-10-15 14:30:05.5+02:00; 2026-10-15T12:30Z
e:: "2026-10-15"; 2026-02-30
f:: true; false; True; FALSE; yes; "true"
Call Anna [due:: 2026-10-15 14:30]
.
root
field "a"
"-12" number
"0" number
"9.5" number
"2026" number
"1e3" number
"2.5E-7" number
field "b"
"007"
"+46"
"1."
".5"
"1e"
field "c"
"2026-10-15" date
"2026-W42" week
"2026-10" month
field "d"
"2026-10-15T14:30" datetime
"2026-10-15 14:30:05.5+02:00" datetime
"2026-10-15T12:30Z" datetime
field "e"
quoted "2026-10-15"
"2026-02-30"
field "f"
"true" boolean
"false" boolean
"True" boolean
"FALSE" boolean
"yes"
quoted "true"
node "Call Anna [due:: 2026-10-15 14:30]"
label "Call Anna"
field "due" inline
"2026-10-15 14:30" datetime
! L26 5:19
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 M27). A reader without type definitions takes them as an option.
Part 3: Files
20. Files
These rules are for tools that find files, such as editors, the index and the language server. A reader is given a file and reads it as Ord.
- F1. An Ord file has no header line and states no version: the workspace (F3), or the extension
.ord, is what makes a file Ord. Tools don't guess from the content..txtis the usual extension;.ordtells an editor to treat a file as Ord anywhere, and is redundant inside a workspace. - F2. Its media type is
text/plain; charset=utf-8, since no media type is registered for Ord. On Apple platforms,.ordis the uniform typecom.pensiveworks.ord, which conforms topublic.plain-text, so apps that don't know Ord open it as text. - F3. In a workspace,
.txtfiles, files without an extension and.ordfiles are read as Ord, so.ord.txtis too. Outside a workspace, only.ordfiles are, so a tool never claims.txtor extensionless files in general. Editors switch a file to Ord only when they would otherwise open it as plain text, so aMakefilekeeps its own language. - F4. A workspace is a folder that holds a workspace file, with everything under it. A file belongs to the nearest workspace above it, its own folder included.
- F5. A workspace file is named
Ord.workspace, in any letter case, such asord.workspace. It is an Ord file, though its name doesn't end in.ord. What it holds is a convention, not a requirement. Other names, such asworkspace.ord, are ordinary files.
Source: Ord_Specification.md in ordlang/ord, licensed under CC BY 4.0.