Progressive Formalization for Markdown using Pydantic and Pytest
Project description

Typedown
Progressive Formalization for Markdown
🚀 Install VS Code Extension · Documentation · Issues
English | 简体中文
Typedown adds a semantic layer to Markdown, transforming it from loose text into a validated knowledge base.
💡 Typedown files (
.td) are designed to be experienced in an IDE. Install the VS Code Extension to get real-time validation, intelligent navigation, and semantic highlighting.
The Problem: Markdown Doesn't Scale
Markdown is the universal standard for technical documentation. But as your repository grows from 10 to 10,000 files, it becomes a "write-only" graveyard:
| Problem | Description | Typedown Solution |
|---|---|---|
| Schema Errors | Inconsistent data: Status: Active vs status: active, missing required fields |
Model - Define structure with Pydantic, validate at compile time |
| Broken References | Links break after moving files: [[./old-path]] points nowhere |
Reference - Content-addressed links that auto-track entity changes |
| Constraint Violations | Rules are broken: admins without MFA, inventory over limit | Spec - Executable business rules for complex constraints |
Core Concepts
1. Model (Schema)
Define data structures using Pydantic:
```model:User
class User(BaseModel):
name: str
role: Literal["admin", "member"]
mfa_enabled: bool = False
```
2. Entity (Data)
Instantiate data with strict YAML:
```entity User: user-alice-v1
name: "Alice"
role: "admin"
mfa_enabled: true
```
3. Reference (Graph)
Link entities with [[...]] syntax:
This task is assigned to [[user-alice-v1]].
Supports ID references ([[entity-id]]) and content hash ([[sha256:...]]).
4. Spec (Validation)
Three layers of validation:
# 1. Field-level - @field_validator
class User(BaseModel):
@field_validator('email')
def check_email(cls, v):
assert '@' in v, "Invalid email"
return v
# 2. Model-level - @model_validator
class Order(BaseModel):
@model_validator(mode='after')
def check_dates(self):
assert self.end > self.start, "End must be after start"
return self
# 3. Global-level - spec
```spec:check_admin_mfa
@target(type="User", scope="local")
def check_admin_mfa(user: User):
if user.role == "admin":
assert user.mfa_enabled, f"Admin {user.name} must enable MFA"
```
Quick Start
Option 1: VS Code Extension (Recommended)
The best way to experience Typedown is through the IDE extension, which provides real-time validation, go-to-definition, and semantic highlighting.
- Install the VS Code Extension
- Clone this repository and open the
cookbook/01_getting_started/folder in VS Code - Open any
.tdfile to see Typedown in action
⚠️ Note: Typedown files (
.td) appear as plain Markdown on GitHub. The full experience requires the VS Code extension.
Option 2: CLI (For CI/CD)
For validating Typedown files in CI pipelines or automation:
# Using uv (recommended)
uv tool install typedown
# Using pip
pip install typedown
# Validate a project
typedown check .
CLI Commands
# Validate the project
typedown check .
# Check with JSON output
typedown check --json
# Run specific validation
typedown check --target User
Documentation
- Getting Started - Build your first model
- Concepts - Model, Entity, Reference, Spec
- Guides - Best practices and advanced topics
Cookbook
The cookbook/ directory contains learning resources designed to be used with the VS Code extension:
cookbook/01_getting_started/- Progressive tutorials (English & 中文)cookbook/02_use_cases/- Real-world examples (bid evaluation, PMO SaaS, ERP)
💡 Tip: Clone the repo and open it in VS Code with the Typedown extension installed for the best learning experience.
License
MIT © IndenScale
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typedown-0.2.19.tar.gz.
File metadata
- Download URL: typedown-0.2.19.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb6d63d5f95b4f52895c2c82f5d80b6631112fce911013ba00cd9138e5f4bfff
|
|
| MD5 |
d87e6d52cdeac4f3afc10bf771358aad
|
|
| BLAKE2b-256 |
ea5759079902efef1ec2f4828f9ecebf706e76ab3c970b8c6051c8fec501a303
|
Provenance
The following attestation bundles were made for typedown-0.2.19.tar.gz:
Publisher:
publish-pypi.yml on IndenScale/Typedown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typedown-0.2.19.tar.gz -
Subject digest:
fb6d63d5f95b4f52895c2c82f5d80b6631112fce911013ba00cd9138e5f4bfff - Sigstore transparency entry: 944103423
- Sigstore integration time:
-
Permalink:
IndenScale/Typedown@e51548bbf5b1468e2021998cf44dea53adeadfeb -
Branch / Tag:
refs/tags/v0.2.19 - Owner: https://github.com/IndenScale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e51548bbf5b1468e2021998cf44dea53adeadfeb -
Trigger Event:
push
-
Statement type:
File details
Details for the file typedown-0.2.19-py3-none-any.whl.
File metadata
- Download URL: typedown-0.2.19-py3-none-any.whl
- Upload date:
- Size: 110.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08a0832c8ef253cebe2a3781567f60685fa1106531c7c1df28f2086e2aba88af
|
|
| MD5 |
edcef1f75acea9cc689c9e524e06a8db
|
|
| BLAKE2b-256 |
0e043d6751a5ef16b1ac816399ab9e8f8618f97b554cb3ba4781ab7775c03bcf
|
Provenance
The following attestation bundles were made for typedown-0.2.19-py3-none-any.whl:
Publisher:
publish-pypi.yml on IndenScale/Typedown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typedown-0.2.19-py3-none-any.whl -
Subject digest:
08a0832c8ef253cebe2a3781567f60685fa1106531c7c1df28f2086e2aba88af - Sigstore transparency entry: 944103425
- Sigstore integration time:
-
Permalink:
IndenScale/Typedown@e51548bbf5b1468e2021998cf44dea53adeadfeb -
Branch / Tag:
refs/tags/v0.2.19 - Owner: https://github.com/IndenScale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e51548bbf5b1468e2021998cf44dea53adeadfeb -
Trigger Event:
push
-
Statement type: