Smarana (स्मरण)
Smarana is a knowledge management and note-taking system built for Typst. It combines the structured approach of a Zettelkasten with the beautiful typesetting capabilities of Typst, providing a seamless flow between capturing fleeting thoughts and developing permanent, interconnected knowledge.
The system is built around a Rust-based CLI that manages a local SQLite database for fast indexing and search, while the documents themselves remain plain Typst files. This ensures your knowledge base is both future-proof and highly performant.
Key Features
- Categorized Note Types: Organize knowledge into Fleeting (transient ideas), Capture (literature and reference notes), and Atomic (permanent, interconnected concepts) notes.
- Automatic Tag Appendix: Every tag used in your notes is automatically indexed at the end of your notebook with clickable reference links.
- Native Cross-Linking: Use standard Typst references to link between notes. Smarana ensures these links stay resolved and easily navigable.
- Live Preview: Integrated support for live rendering of the entire notebook or individual notes using
typst-preview. - Flexible Organization: Notes are managed via a database, allowing you to focus on content rather than directory hierarchies.
Installation
CLI Tool
The core of Smarana is the Rust CLI. You can install it via cargo:
This will provide the sma command globally.
Typst Setup
Smarana requires typst to be installed on your system. You can find installation instructions at the official Typst repository.
Neovim Plugin
For the best experience, Smarana is designed to be used with Neovim. You will also need typst-preview.nvim for live visualization.
Example Configuration
Below is a complete setup using a standard plugin manager syntax. This configuration handles auto-start previews, global notebook resolution, and convenient keymaps.
-- Typst Preview Setup (Essential for visualization)
vim..
local ok, typst_preview = pcall
if ok
-- Smarana Setup
vim..
local ok_sma, smarana = pcall
if ok_sma
Getting Started
-
Initialize a Notebook: Navigate to the directory where you want to store your notes and run:
This creates a
.smaranadirectory containing your configuration, templates, and the SQLite index. -
Configure Global Path: Smarana can be used from anywhere if you register your notebook path in the global config. The initialization process usually handles this, but you can check it in
~/.config/smarana/config.toml. -
Check Your Configuration: Before you start taking notes, it is recommended to review the configuration file inside your notebook's
.smaranadirectory namedconfig.tomlto set it up to your liking: -
Create Your First Note: Use
sma -n "My First Note"or the:SmaNewcommand in Neovim. -
Synchronize: If you manually move or edit files, run
sma -sto keep the database and thesmarana.typmaster document up to date.
How it Works
Smarana treats every note as a Typst document that imports a central library.typ. When you sync your notebook, the CLI performs several tasks:
- It parses the frontmatter of every
.typfile in your root directory. - It updates a local SQLite database with metadata like titles, dates, and tags.
- It regenerates the
smarana.typfile, which includes all your notes organized by category, separated by visual dividers, and concluded with the Tag Appendix. - It ensures that all cross-references resolved via
@labelsyntax work across the entire notebook.
By separating the content (Typst files) from the organization (SQLite + master document), Smarana allows your knowledge base to scale to thousands of notes without becoming unmanageable.