sable is a obsidian renderer that powers my website.
-
Markdown
- Escaping
- Frontmatter
- YAML
- TOML
- JSON
- Syntax Highlighting
- Github Flavored Markdown
- Autolinks
- Tables
- Task List Items
- Strikethrough
- Obsidian Flavored Markdown
- Callouts
- File Includes
- Tags
- Wikilinks
-
Obsidian Vault
- Base
- Canvas
- Graph
- Note
-
Sable
- Build time assets (eg: running Tailwind)
- Custom data loading
- Dev Server
- Support HTML notes
sable is somewhat configurable with its config file and command line arguments.
Config is stored is in the sable.toml file, and only some settings can be
overwritten by command line arguments.
interface Config {
// CLI: --dist
dist: string = `${CWD}/dist`;
// CLI: --static
static: string = `${CWD}/static`;
// CLI: --templates
templates: string = `${CWD}/templates`;
// CLI: --src
vault: string = `${CWD}/content`;
// The port the dev server will run on
// CLI: [serve] --port
port: number = 3000;
// The default template a Note will be rendered with if not provided a layout
// Defaults to a 'hidden' internal template
default_template: string;
// Custom data that will be available to a template
data: ConfigData;
}
interface ConfigData {
[key: string]: any;
}sable uses Tera for templating, see its documentation for more information.
Which template is used to render a note can be changed by setting the
template frontmatter variable, otherwise it uses an included 'default'
template.
const meta: Meta;
// `meta` is meta information about `sable` itself
interface Meta {
package_name: string;
package_version: string;
git_dirty: boolean;
git_hash: string;
}
const data: Data;
// `data` is any data passed in from the config (if it exists)
interface Data {
[key: string]: any;
}
const note: Note;
// An Obsidian note
interface Note {
path: NotePath;
name: string;
title: string;
metadata: NoteMetadata;
properties: NoteProperties;
toc: NoteHeading[];
contents: string;
}
interface NotePath {
vault: VaultPath;
full: string;
relative: string;
slug: string;
}
type VaultPath = string;
// Contains a Note's file system metadata
interface NoteMetadata {
created: string;
modified: string;
git_created: string | null;
git_modified: string | null;
}
// This is actually the note's frontmatter
// Its called properties as `sable` supports YAML, TOML, and JSON frontmatter
interface NoteProperties {
[key: string]: any;
}
interface NoteHeading {
level: number;
id: string;
title: string;
children: NoteHeading[];
}
// Renders a string to Markdown
function markdown(in: string): string;