tir-embedded
July 16, 2026 ยท View on GitHub
Embedded table <-> TIR converter backend for tirenvi.
Install
pip install tir-embedded
Usage
tir-embedded parse file --cursor-line=<n> > file.tir
tir-embedded unparse file < file.tir
<n> specifies the current cursor line (1-based).
--cursor-line is intended for editors such as tirenvi. Other backends ignore this option.
The parser uses this line to determine which embedded table to parse and which table prefix (key) to use.
Embedded table format
An embedded table consists of consecutive lines that:
- contain at least two
|characters - end with
|(ignoring trailing whitespace) - share the same prefix (
key)
Example:
// |Name|Age|
// |Alice|20|
// |Bob|30|
or
# |Name|Age|
# |Alice|20|
# |Bob|30|
The key is the text before the first | (excluding leading/trailing whitespace).
The parser determines the key from the first table found at or below the cursor line.
Only tables with that key are considered.
Behavior
- Embedded tables may appear in any text file.
- Tables are separated by blank lines or lines with a different key.
- Rows may have different numbers of cells. The maximum column count is used.
- A literal
|inside a cell is written as\|. - A newline inside a cell is represented as
<br>.
Note
This parser is intentionally simple.
- It is not tied to any particular programming language.
- It does not parse language syntax.
- It only recognizes embedded tables based on the table format described above.