qnosuke22 downloadsOpen and edit Ledger CLI files (.ledger) with VSCode-style syntax highlighting.
Open and edit Ledger CLI plain-text accounting files (.ledger) directly inside Obsidian, with VSCode-style syntax highlighting.
Syntax rules are ported from the VSCode extension vscode-ledger (MIT License), and the color palette follows VSCode's default Dark+ / Light+ themes. Highlighting automatically follows Obsidian's dark/light theme.
.ledger / .ldg / .ldgr / .journal / .hledger files with a clickCmd/Ctrl+S)Once approved, install from Obsidian's Community Plugins browser ("Ledger Viewer").
Manual install (before approval / from source):
main.js, manifest.json, and styles.css into
.obsidian/plugins/ledger-view/ inside your vault| Element | Example | TextMate scope | Dark+ | Light+ |
|---|---|---|---|---|
| Date | 2024/04/01 |
string.other.date |
#CE9178 |
#A31515 |
| Effective date | =2024/05/02 |
same | same | same |
| Amount | 3,480 -100,000 |
constant.numeric.amount |
#B5CEA8 |
#098658 |
| Currency | JPY USD ¥ |
constant.other.currency |
default | default |
| Account (posting) | Assets:Cash |
markup.bold.account |
bold | bold |
| Virtual posting | (Assets:Cash) |
markup.italic.account |
italic | italic |
| Directive | account commodity include Y P |
keyword |
#569CD6 |
#0000FF |
payee directive |
payee store |
keyword.control |
#C586C0 |
#AF00DB |
| Identifier args | value of alias, path of include |
variable.other |
#9CDCFE |
#001080 |
| Expression | = Expenses:Food > 10000, assert/check/eval |
string.regexp |
#D16969 |
#811F3F |
| Cleared description | * description |
markup.italic.desc |
italic | italic |
| Pending description | ! description |
markup.underline.desc |
underline | underline |
| Comment | ; # % | * at line start / comment block |
comment |
#6A9955 |
#008000 |
Note: one deliberate improvement over VSCode — for lines like account X ; comment,
VSCode drops the whole line's coloring, while this plugin keeps the keyword and account
colors and only colors the trailing comment green.
npm install
npm run build # type-check + build main.js
npm test # tokenizer tests (sample.ledger)
Ledger CLI のファイル(.ledger など)を Obsidian 内で開けるようにするプラグインです。
シンタックスハイライトは VSCode 拡張 vscode-ledger (MIT) の TextMate 文法を移植し、配色は VSCode 標準テーマ (Dark+ / Light+) に合わせています。Obsidian のテーマ(ダーク/ライト)に応じて自動で切り替わります。
.ledger / .ldg / .ldgr / .journal / .hledger ファイルをクリックで開くCmd/Ctrl+S)npm install
npm run build # 型チェック + main.js ビルド
npm test # トークナイザーのテスト(sample.ledger)