Lexicon Markup Language
A simple markup language for defining AT Protocol lexicons. Write human-readable field definitions, and Cards will generate both the AT Protocol lexicon JSON and Python dataclasses.
Quick Start
name: Task Card
description: Track tasks with priority and due dates
fields:
title: string required max:300
details: text max:10000
priority: enum(low, medium, high, critical) default:medium
due_date: datetime
tags: array:string max:10
completed: boolean default:false
Syntax
Header Section
| Field | Required | Description |
|---|---|---|
name: |
Yes | Human-readable name for the card type |
description: |
No | Description of what this card type is for |
Fields Section
Start with fields: then indent each field definition:
fields:
field_name: type [modifiers]
Available Types
| Type | Description | AT Protocol Type |
|---|---|---|
string |
Single line text | string |
text |
Multi-line text (renders as textarea) | string |
boolean |
True/false | boolean |
integer |
Whole number | integer |
datetime |
ISO 8601 date/time | string with format: datetime |
uri |
URL/URI | string with format: uri |
did |
AT Protocol DID | string with format: did |
handle |
AT Protocol handle | string with format: handle |
enum(a,b,c) |
Enumerated values | string with knownValues |
array:type |
List of items | array with item type |
Modifiers
| Modifier | Description | Example |
|---|---|---|
required |
Field must have a value | title: string required |
max:N |
Maximum length (strings) or items (arrays) | title: string max:300 |
default:value |
Default value | status: enum(a,b) default:a |
Examples
Simple Note
name: Note
description: Quick notes and thoughts
fields:
content: text required max:5000
pinned: boolean default:false
Project Task
name: Project Task
description: Task with assignee and dependencies
fields:
title: string required max:200
description: text max:5000
assignee: handle
status: enum(todo, in_progress, blocked, done) default:todo
priority: enum(low, medium, high, urgent) default:medium
due_date: datetime
tags: array:string max:5
blocked_by: array:string max:10
Link Bookmark
name: Bookmark
description: Save and organize links
fields:
title: string required max:200
url: uri required
notes: text max:1000
tags: array:string max:10
read: boolean default:false
Generated Output
AT Protocol Lexicon
The markup generates a lexicon JSON file in lexicons/com.statmeet.cards/:
{
"lexicon": 1,
"id": "com.statmeet.cards.task",
"defs": {
"main": {
"type": "record",
"description": "Track tasks with priority",
"key": "tid",
"record": {
"type": "object",
"required": ["title", "createdAt"],
"properties": {
"title": {
"type": "string",
"maxLength": 200
},
"status": {
"type": "string",
"knownValues": ["todo", "in_progress", "done"],
"default": "todo"
},
"createdAt": {
"type": "string",
"format": "datetime"
}
}
}
}
}
}
Python Dataclass
A Python dataclass is also generated for form handling:
@dataclass
class Task:
title: str
status: str
card_name: str
active: bool
federated: bool
API Endpoints
List Lexicons
curl https://your-app.com/xrpc/com.statmeet.lexicon.listLexicons
Get Lexicon Definition
curl "https://your-app.com/xrpc/com.statmeet.lexicon.getLexicon?id=com.statmeet.cards.task"
Usage in Cards
- Go to Lexicons in the navigation
- Click Create Lexicon
- Write your markup definition
- Click Preview to see the generated JSON
- Click Create Lexicon to save
Once created, the lexicon appears in the template selector when creating new cards.