Authoring Guide
This guide explains how to design, implement, and publish TDL extensions.
What is a TDL Extension?
A TDL extension adds optional capabilities to the core TDL specification. Extensions follow the graceful degradation principle: any valid TDL file must parse successfully in any compliant renderer, even if extension features are not displayed.
Extension Types
1. Property Extensions
Add new node/edge/group properties.
Example: ext:icons adds |icon:name property
db:Database|icon:postgresql2. Section Extensions
Add new section types with custom syntax.
Example: ext:code adds [code] section
[code]
init:javascript:Setup
const app = express();3. Behavior Extensions (Future)
Add interactive behaviors like animations, linking, or state management.
Designing an Extension
Step 1: Define the Problem
What capability are you adding?
Why isn't this in core?
Can it gracefully degrade?
Step 2: Design the Syntax
Follow these principles:
Minimal syntax - Token efficiency matters
Pipe-separated properties -
|property:valueConsistent with core - Use existing patterns
Step 3: Define Graceful Degradation
For each feature, specify what happens when a renderer doesn't support it:
|icon:aws
Shows AWS icon
Ignored, label shown
[code] section
Code panels
Section parsed but not rendered
Extension Specification Format
Create a markdown file with this structure:
Syntax
Document all syntax additions:
New properties
New sections
New values
Graceful Degradation
How should renderers without this extension behave?
Implementation Notes
Guidance for implementers.
Version History
1.0: Initial release
Handle missing gracefully:
Adding a New Property Extension
Properties are already parsed by the core parser:
Extract in your renderer:
No parser changes needed!
Adding a New Section Extension
For new sections, you have two options:
Option A: Use existing section parsing (recommended for simple cases)
Add your section name to
SectionNametype inast.tsHandle in semantic analyzer
Option B: Fork/extend parser (for complex syntax)
Only if the section has unique syntax requirements
Submit PR to core if broadly useful
Publishing an Extension
Official Extensions
To propose an official extension:
Create a spec in
docs/tdl/extensions/your-ext.mdImplement in at least one renderer
Write tests demonstrating graceful degradation
Submit PR with:
Spec document
Reference implementation
Tests
SUMMARY.md update
Community Extensions
For unofficial extensions:
Use a namespaced identifier:
community:your-extPublish spec in your own repo
Link from the extension registry (if we create one)
Document graceful degradation clearly
Extension Registry (Future)
We plan to create an extension registry:
Best Practices
DO:
Keep syntax minimal and consistent
Document graceful degradation clearly
Provide implementation examples
Version your extension
Test with multiple renderers
DON'T:
Add syntax that breaks core parsing
Require extensions for basic diagrams
Create extensions that can't degrade gracefully
Use reserved identifiers (core section names, properties)
Example: Creating a Simple Extension
Let's create ext:links to add clickable URLs:
1. Spec (docs/tdl/extensions/links.md)
docs/tdl/extensions/links.md)Graceful Degradation
With ext:links: Node is clickable, opens URL
Without ext:links: URL property ignored, node renders normally
3. Renderer Implementation
Questions?
Open an issue on the TDL repository
Join the discussion on GitHub Discussions
Check existing extensions for patterns
Last updated