Write Obsidian-flavored Markdown in any text editor (including Obsidian itself) and preview an html preview in real-time.
- Automatically build an archive page with all the notes in the Vault sorted chronologically.
- Automatically build an index page for all the tags that appear throughout the notes.
With a current stable Rust toolchain installed:
cargo install oxidian --lockedLive preview additionally requires Node.js and live-server (see below).
git clone https://github.com/Mathijssch/oxidian.git
cd oxidian
cargo install --path . --lockedOnce oxidian is installed, you can run it using
oxidian build <notes_directory>
This will output a new directory called <notes_directory>_out containing
your notes in html.
Check oxidian --help to get more information about the available commands
and their arguments.
More advanced usage allows for multiple notebooks. Each notebook is just a directory on your machine.
Oxidian keeps track of notebooks you've "registered" in a json file. You can "register" a notebook by running
oxidian notes define work --src ~/notes/work --out ~/notes/work_outThis will add an entry to this json file.
To edit it
oxidian notes edit workThen to open a web browser with your notes in them, run
oxidian notes serve workdefine can also be used interactively (i.e., without arguments).
Then it simply prompts for missing paths.
A summary of all the available obsidian notes subcommands.
| Command | Purpose |
|---|---|
oxidian notes |
Edit the notebook named default |
oxidian notes edit [name] |
Open a notebook in $EDITOR (fallback: nvim) |
oxidian notes define [name] [--src PATH] [--out PATH] |
Register or update a notebook |
oxidian notes serve [name] |
Build, watch, and open a live preview |
oxidian notes list |
List notebook names and effective source/output paths |
oxidian notes pwd [name] |
Print just the source path, e.g. cd "$(oxidian notes pwd work)" |
oxidian notes config |
Edit the registry, including repairing malformed JSON |
oxidian notes import PATH |
Import notebooks from another registry |
The notebook name defaults to default. edit and serve offer to register an
unknown name in a terminal; noninteractive invocations report an error instead.
Editor arguments and quoting are supported, for example EDITOR='code --wait'.
The editor runs with the notebook as its working directory.
The registry is $XDG_CONFIG_HOME/oxidian/notes.json, or
~/.config/oxidian/notes.json when XDG_CONFIG_HOME is unset. Override it with:
oxidian notes --registry /path/to/notes.json listOn Windows, USERPROFILE is used when HOME is unset.
Its JSON format is:
{
"default": {
"src": "/home/me/notes",
"dist": "/home/me/notes_out"
}
}dist is optional and defaults to <src>_out. Legacy source-only entries such as
"work": "/home/me/work-notes" are also accepted. Paths support ~; relative
paths in a registry are relative to that file's directory, while command-line
paths are relative to the current directory. Registration and import save
absolute paths. Per-notebook export settings remain in the notebook's
config.toml.
If you already had a list of registered notes, you can import them as follows:
oxidian notes import "$DOTFILES/home/notes.json"
oxidian notes listImport skips identical entries and rejects conflicting names without partially updating the registry.
Preview requires Node.js and live-server on PATH:
npm install -g live-server
oxidian notes serve workOxidian completes the initial build, starts a localhost server, opens the browser,
and watches for edits. live-server reloads the browser when generated files
change. Press Ctrl+C to stop both the watcher and server.
Options: --out PATH overrides the registered output for this invocation,
--cfg PATH selects a config file, --full enables full rebuilds, and
--port PORT selects a fixed port (Otherwise Oxidian chooses an available port
starting at 8080).
The active port is written to <source>/.live_port.
This feature was included for editor integrations. For instance,
I have set up a shortcut in Neovim that opens the browser preview of the currently
opened note by checking the .live_port file.
This file is removed when the session ends.
One preview can run per notebook; different notebooks can be previewed simultaneously. The empty .oxidian-preview.lock file remains in the notebook, but its OS lock is released when the session ends.
Several settings can be set in a config.toml file, which oxidian looks for
in the root of your notebook.
TODO: document the configuration
Setting the RUST_LOG environment variable controls the logging level.
For instance, to get some feedback on what oxidian is doing,
run export RUST_LOG=info before calling oxidian.
Licensed under either the MIT license or the Apache License, Version 2.0, at your option.
There are many options. For instance, check out Obsidian awesome.
- Detect broken links
- Properly differentiate between absolute and relative paths
- The above two could be merged:
- First assume the link is relative and check existence of the file.
- If not found, try absolute.
- If still not found, then mark as a broken link.
- (Link previews)
- Handle size arguments in included figures
- Generate tag overview pages
- Populate navbar
- Refactor so that the exporter only handles io. This makes it easier to unit test operations independently from the file system.
- [~] Unify the way the filenames for tags are generated. See filenames for tags.
- Use Handlebars for templating
- Generate timeline page
- Build search index: see
search.rs. - [performance]: cache the backlinks.
- Loop over the recently modified notes, and for each, loop over the keys, and just add/remove accordingly.
- [performance]: Replace as many
Strings as possible withCow<Str>s. - [performance]: Search the location of a file by first copying the file tree to memory. This will save many syscalls.
- [performance]: Use AhoCorasick crate for multiple replacements in a string.
- This is very much a work in progress and is neither efficient, nor complete.
- There are still many
unwrap()statements in the code, which should be replaced by proper error handling.