.krish
.krish is a small document format that renders structured notes to standalone HTML.
Usage
@document title="System Design Notes" {
@meta {
author: "Krish"
version: "0.1"
}
@section title="Overview" {
A paragraph of text.
@table title="Components" {
| Component | Responsibility |
| Parser | Reads .krish files |
}
```python
print("Hello from .krish")
```
}
}
Render the example document with:
python main.py testing.krish --output preview.html
The input and output paths are optional. With no arguments, the command reads
testing.krish and writes preview.html.
For a direct live browser preview, use:
python main.py testing.krish --serve
This starts a local server, opens the document in your browser, and refreshes
the page when you save the .krish file. Press Ctrl+C in the terminal to
stop it. Use --port 8001 if port 8000 is already in use.
Creating a .krish file
Create a normal text file, save it with the .krish extension, and put the
following in it:
@document title="My Notes" {
@section title="Today" {
This is my first Krish document.
}
}
Then run python main.py path/to/my-notes.krish --serve.
VS Code preview
The repository is also a VS Code extension. It adds .krish file recognition,
syntax highlighting, and a preview button like Markdown's preview button.
- Open this project folder in VS Code.
- Press
F5 and choose Extension Development Host if prompted.
- In the new VS Code window, open a
.krish file.
- Click the preview icon in the editor title bar, or run Krish: Open Preview to the Side from the Command Palette.
- Edit the source on the left; the preview updates as you type.
The extension uses python by default. If that is not on your PATH, set this
in VS Code settings:
{
"krish.pythonPath": ".venv\\Scripts\\python.exe"
}
To package it for a normal installation, install vsce and run:
npx @vscode/vsce package
code --install-extension krish-language-0.1.0.vsix
Supported directives
Directives begin on their own line (indentation is allowed), which keeps
ordinary @mentions and email addresses usable in paragraphs.
@document title="..." — required root document.
@meta — metadata text containing quoted author and version values.
@section title="..." — titled content section.
@grid columns=2 gap=16 — lays out child blocks in a CSS grid.
@table title="..." — pipe-separated rows; the first row is the header.
- Fenced code blocks — optional language names are preserved as CSS classes.
Run the built-in tests with:
python -m unittest discover