The Line Record Format (LRF) is a human-friendly, line-oriented data format designed for simplicity of both human editing and machine parsing. Every LRF document is also a valid Markdown document, making it suitable for embedding structured data in plain-text documentation.
- Human editable – Accessible to users with minimal technical skills, using any text editor.
- Machine readable – Deterministic, unambiguous grammar that can be parsed with simple, line-by-line logic.
- Readability over size – Whitespace and clarity are preferred; minimalism in storage is not a goal.
- Markdown subset – Any LRF document is also a valid Markdown document. This allows structured data to live inside README files, notes, or any Markdown rendering environment without breaking the document flow.
Each non-empty, non-blank line contains a field name, one or more whitespace characters, and a field value:
field-name field value
- Record separator – A new record begins with the keyword
RECORDor the hash character#, optionally followed by an identifier. - List items – Unordered lists use
-or*as field names; numbered lists use a numeric field name (with or without a trailing period).
Input (LRF text):
RECORD Customer Example
customer-name Fred Smith
customer-email fsmith@example.com
customer-phone +1 555 123 4567
RECORD Fruit Example
1 Grapes
2 Oranges
- Peaches
* Mandarines
* Strawberries
* Raspberries
Parsed output (shown as # for records, matching the algorithm’s normalisation):
# : Customer Example
customer-name : Fred Smith
customer-email : fsmith@example.com
customer-phone : +1 555 123 4567
# : Fruit Example
1 : Grapes
2 : Oranges
- : Peaches
* : Mandarines
* : Strawberries
* : Raspberries
Whitespace characters are defined as:
- Horizontal tab (
\t, U+0009) - Any character in Unicode General Category Zs (Space Separator), which includes the common space (U+0020), non-breaking space (U+00A0), and others.
All leading and trailing whitespace on a line is ignored (trimmed). The first internal whitespace character after the field name acts as the separator; any immediately following whitespace is consumed and does not become part of the value.
Lines are terminated by a line feed (\n, U+000A). Carriage return characters (\r, U+000D)
immediately preceding the line feed are discarded.
[record marker line] ← begins a record
[field data line]*
[blank line (ignored)]*
[record marker line] ...
A record marker line is a line whose field name is RECORD (case‑sensitive, uppercase) or
#. The field value on that line serves as the record identifier or type. # and RECORD are
completely equivalent; a parser may normalise RECORD to # internally.
A field data line consists of:
- Field name (key) – any sequence of characters that does not contain whitespace.
If a space must be represented in the name, use one of the encodings:
%20,+,-, or_. - Separator – one or more whitespace characters (the exact amount is arbitrary and need not be consistent across lines).
- Field value – the remainder of the line after the separator, with trailing whitespace removed.
Example field data lines:
customer-name Fred Smith
field-example-2 Many, many spaces in-between.
- Named fields – Any field name not matching a special keyword. Parsers should match these against a whitelist of known field names for the current record type when validation is desired.
- Unordered lists – Field names
-or*. - Ordered lists – Field names consisting entirely of decimal digits, optionally followed by a
period (e.g.,
1,2.,42). - Title (optional) – Field name
TITLE(treated as a named field by default; parsers may assign it special meaning).
Lines that are empty after trimming are ignored. They may appear anywhere between records or fields without affecting the parsed structure.
The following algorithm processes a raw LRF string into an ordered list of key‑value pairs (represented as single‑key dictionaries or similar structures):
- Escape single quotes and discard any
\rcharacters. - Split the text by
\ninto individual lines. - For each line:
- Trim leading and trailing whitespace.
- If the line is now empty, skip it.
- Locate the first whitespace character.
- If none exists: field name = entire trimmed line; field value = empty string.
- If found: field name = text before that whitespace (trimmed); field value = text after that whitespace (trimmed), consuming any immediately following whitespace characters.
- Categorise by field name:
- If field name is in a provided list of recognised fields → output
{name: value}. - If field name is
RECORDor#→ output{"#": value}. - If field name is
TITLE,-,*, or a purely numeric string → output{name: value}. - Otherwise, skip the line (unrecognised).
- If field name is in a provided list of recognised fields → output
Reference implementations in Python, JavaScript, Swift, and Objective‑C are available here (link to implementations).
LRF is intentionally designed to be a subset of Markdown. An LRF document is always valid Markdown text. This is achieved as follows:
- The field name–value separator (whitespace) causes Markdown renderers to treat each line as a plain paragraph or, when the field name is a list marker, as a list item.
- Record markers (
RECORDor#) become headings when the line starts with a#or plain paragraph text forRECORD. - Unordered lists (
-,*) render as Markdown bullet lists. - Numbered lists render as ordered lists.
Because LRF uses only a small subset of Markdown, it can be embedded inside existing Markdown documents without conflict. This property also means that a reader seeing an LRF snippet in a web‑rendered README will perceive it as well‑formatted plain text, while a machine parser can extract the exact structured data.
Note: The
text/line-recordmedia type and file extensions.txtor.rlare suggested when LRF is used independently. When embedded in Markdown, the standard.mdextension suffices.
The format itself is described by the following fields, which can be included as an LRF record for self‑documentation:
| Field | Value |
|---|---|
format-author |
Andrew Kingdom |
format-copyright |
2023, all rights reserved by the author |
format-name |
Line Record Format |
format-license |
CC‑BY (Use freely, retain copyright notices) |
media-MIME-type |
text/line-record |
file-extension |
.txt or .rl (whitespace‑separated record lines) |
This specification is licensed under the Creative Commons Attribution 4.0 International
(CC‑BY 4.0). You are free to share and adapt the material as long as appropriate credit is given.
See the format-license field above.
Sharing this as a rough reference for clients and developers.