Repository navigation
Upgrading from hledger 1 ? See Upgrading to hledger 2.
hledger 2 is developed with careful, disclosed AI assistance, and uses no AI at runtime;
see hledger 2 and AI and the AI policy.
Release notes
hledger 2: lot tracking and capital gains, a holdings report,
charts, twelve UI languages, assert rules, new queries,
easier setup and importing, journal format improvements, custom commands,
a much more capable hledger-web, auto-reloading hledger-ui,
and 2-3x more speed.
hledger 2.0
All changes since hledger 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
hledger 2 is the first hledger release developed with AI assistance;
see the https://hledger.org/relnotes.html intro and https://hledger.org/AI.html.
For more help with upgrading, see https://hledger.org/upgrading.html.
Highlights
The most notable changes since hledger 1.52; each is described in its section below.
- Lot tracking and capital gains: cost basis, lot movements and gains are tracked, checked and inferred;
and a newholdingsreport shows your investments' performance. (Investments) - Charts: most reports can be shown as charts in the terminal, or as SVG or HTML, with
--chart;--viewopens any report in a viewer. (Reporting) - Translations: hledger, hledger-ui and hledger-web can be shown in 12 languages, and new languages are easy to add. (Running hledger)
- Assert rules: standing rules about your data, written as queries and checked like balance assertions. (Journal format)
- New queries:
::(short forfind:) searches in all fields, andchange:andbalance:select report rows by their amounts. (Reporting) - Easier setup and importing:
initcreates starter files,getfetches data and prices, andimportneeds no arguments;
CSV rules gainmerge, functions,ifstables and amount expressions. (Getting data in) - Journal format: amount expressions, commodity aliases, account alias tags, and CSV files included in journals. (Journal format)
- Custom commands, defined in your config file; a reorganised
help; and an improvedreplandrun. (Running hledger) - Speed: hledger is 2-3x faster than 1.52, and uses up to a third less memory. (Performance)
Breaking changes
hledger 2 reads hledger 1 data, and most users will need no changes.
But here are the breaking changes you might encounter.
(These are described more fully in the sections below.)
Changes in how files are read:
-
Config files can no longer select the command to run with a bare first word in the general section.
(Now such a word is read as a query argument.) The command must be given on the command line.
(Config files) -
A repeated commodity declaration now adds to the earlier one instead of replacing it,
and with several-ffiles the last file's display style is used, not the first's.
(Journal format) -
Amounts which hledger infers no longer affect commodities' display precision, or the precision used to balance the entry.
So some reports show fewer decimal places.
(Journal format) -
aliasdirectives are now applied beforeapply account, as in Ledger.
(Journal format) -
apply yearis now scoped, as in Ledger:end apply yearrestores the previous default year.
(Journal format) -
In CSV rules, when a setting like
date-formatorseparatoris declared more than once, the last one now wins (exceptskip).
And thesourceandarchiverules now read from and save to adata/directory next to the journal.
(Data import) -
Sales with a cost basis annotation and no gain posting now get an inferred gain posting, to
revenues:gainby default.
(Lot tracking)
Changes in commands and output:
-
printnow aligns amounts by their decimal mark.--layout=hledger1gives the old layout. -
registernow hides zero-amount postings unless-Eis used. -
activitynow shows transactions per week, as a chart;activity --postings -D -0gives the old report. -
--tldris now--examples.stats -1is nowstats --oneline.--txn-balancing=exact|oldis now--txn-tolerance=entry|display(the old spelling still works).
--verbose-tagsis now an option ofprintandrewriteonly.commodities --usednow shows only commodities used in transactions. -
hledger testis nowhledger --test. Thedemocommand is removed.
The hledger-check-fancyassertions add-on is removed, replaced by assert rules. -
accountsandpayeesnow respect transaction-specific query terms likedate:ordesc:,
which no longer match declared but unused accounts or payees.any:andall:queries now also work in posting reports.
New query prefixes (find:,change:,balance:) mean that account names beginning with those needacct:.
(Queries) -
In JSON output, postings'
ptypefield is renamed topreal.
In csv/html output, print's debit column now comes before credit, and aregister's "change" column is now "amount".
New errors you might see:
-
With a
decimal-markdirective (or CSV rule) in effect, a number clearly using the other decimal mark (1,000.00whendecimal-mark ,is declared),
or using the declared mark more than once (1.2.34, previously read as 1234), is now an error.
(#1985, #1904) -
A hyphenated date range like
2026-13is no longer read as "from 2026 to the 13th of this month"; it is rejected as a mistyped date.
(Write2026..13for that.) -
Account names with an empty part (beginning or ending with
:, or containing::) are now an error.
And account names whose last part is enclosed in curly braces (assets:{foo}) are reserved for lot subaccounts, and must contain a valid lot name.
(Journal format) -
An unquoted commodity symbol can no longer begin with
(when written before the number, or with/when written after it,
because of the new amount expressions; eg(A) 10or10 /kgmust now be written"(A)" 10or10 "/kg".
(Journal format) -
In CSV rules files,
*at the start of a line no longer begins a comment; use#or;.
And more than onesourcerule in a rules file (including its included files) is now an error.
(Data import) -
Ledger-style
assert EXPRdirectives, previously ignored, must now use hledger's assert syntax.
And anend apply yearwith no matchingapply yearis an error.
(Assert rules, Journal format) -
Cost basis annotations like
{$50}, which hledger 1 ignored, are now interpreted and checked.
So entries using them may be rejected, eg if a purchase's{}cost basis and@cost disagree,
if a sale takes from a lot which was never acquired, or if a sale's@is not the selling price.
-Ior--ignore-lotsdisables this.
(Lot tracking)
Running hledger
Command line
-
acc,comm,descare now official short spellings for theaccounts,commoditiesanddescriptionscommands.
When an-Ovalue looks like a file name, the error suggests-o.
With an unrecognised argument, the error shows it, and the config file it came from, if any (#2489).
hledger no longer duplicates options in theLESSenvironment variable. -
Colour handling is more robust: ANSI colour is no longer used when
TERM=dumb, eg in an Emacs shell (--color=yesoverrides);
colour works in terminals where the background lightness can't be detected (a light background is assumed);
and in terminals without truecolor support, we downgrade to the nearest xterm 256-colour. -
The built-in unit tests are now run with an option,
hledger --test[=PATTERN], not a command. -
Fixed: option handling is more robust: a missing option value gives a clear error (eg
hledger import -f --dry-runno longer
uses--dry-runas the file name); bad option values are always reported; and a flag belonging to another command gets an accurate error.
(Kevin F. Konrad, #2696) -
Fixed:
-o -now writes to stdout, as documented; with-o FILE, an error no longer leaves an empty or truncated file behind;
stats -o FILEwrites all of its output to the file; and on Linux, output redirected to a file on a network drive (eg a CIFS mount) is no longer silently truncated. -
Multi-period reports with more than 10000 periods, or a
--forecastgenerating more than 100000 transactions, now print a warning,
so you can cancel. Such numbers usually mean a mistyped date, and could use many gigabytes of memory.
(#1683) -
Fixed: command line arguments are now passed to addon commands exactly as typed; apostrophes, empty strings or other special characters
could be mangled or dropped. (Except on Windows, where addons are still run through the shell.)
And options written after--are passed through to an addon command rather than consumed by hledger.
(Kevin F. Konrad, Arthur Cinader, #2696) -
Fixed: on Windows, file paths containing spaces are now quoted properly when running external helpers (info, man, tldr, pager,
$EDITOR, hledger-iadd).
(#2646) -
hledger is now built with GHC runtime system options enabled.
So eghledger +RTS -M2G -RTS ...caps memory use (an overflow will raise an error rather than consuming all memory),
and+RTS -cuses 20-40% less memory at the cost of speed.
Config files
-
You can now define custom commands (command aliases), by adding
NAME = COMMAND...to the[alias]section of your config file.
COMMAND can be a builtin command, an addon command, another alias, or a shell command prefixed with!, and can be continued on multiple indented lines.
(Shell commands run only from your user config file, or one specified explicitly with--conf.) -
Config files can no longer specify the command to run via a bare first word in the general section;
with command aliases able to run shell commands, that was too risky. -
Config file errors now use hledger's standard error format, and say how to run without the config file (
-n).
--help,--versionand--testnow work despite config file errors. -
Fixed: a
#inside quotes is no longer misparsed as a comment start; leading whitespace before a section header,
and a final line with whitespace and no newline, are accepted; and--conf/--no-confflags inside a config file are ignored.
Help
-
helphas been reorganised, and is now an entry point for all hledger docs:helpwith no arguments (orhledgerwith no command) shows a quick reference card.help commandsshows the full commands list (--builtins,--addonsand--aliaseslimit it).help examples [CMD]shows command examples (like--examples, formerly--tldr).help usage [CMD]shows command options and docs (like-h).help manual [TOPIC]orhelp TOPICshows the manual, in several formats, now including the HTML versions at hledger.org
(--webman). Topics are matched by exact match or unique prefix, in the hledger-ui and hledger-web manuals too,
andhelp manual -llists them.help install/docs/support/home/sponsor/relnotesopen the corresponding hledger.org page in a web browser.
(Arthur Cinader)
-
When
TERM=dumb, or in Emacs shells that don't support TUIs,help manualshows plain text instead of failing to run a viewer.
his help's official alias, and the-?flag also shows the quick reference. Thedemocommand, which played asciinema recordings, is removed.
REPL & run
-
The REPL now auto-reloads before each command, detecting changes in input files, the config file, or installed addon commands (
--no-watchdisables this).
Changes to CSV rules files and their data files are detected too.
It shows a small startup banner, and the journal's file name in the prompt;handqare help and quit;
helpandCMD -hshow the same full, paged output as at the command line, and work even when there's a problem in the journal. -
Most general flags given to
replorrunat startup (such as-I,--strict,-b/-e,--depth,--cost,--color)
now apply to every command in the session or script (and can be overridden per command).
An-fat startup sets the default journal file(s) for all commands, including addons; a nonexistent default journal file is tolerated. -
Quoted arguments in
run/replcommand lines and in config files are now tokenised more like the shell:
quotes can enclose part of an argument, sodate:'1 to 15'is the single argumentdate:1 to 15.
Also like the shell, a lone quote within an argument (egdesc:o'brien) must now be quoted or avoided. A bad command line gives a proper error. -
runscripts are more robust: running an addon command no longer ends the script. -
runwith-O html,-o FILE.htmlor--viewwrites its commands' outputs as one combined html page,
with a folding section for each command, and links to show just titles, charts, or all data.
Eg:hledger run --view -- is -M --chart -- bs -Q --chart.
Translations
-
hledger, hledger-ui and hledger-web can now be shown in 12 languages:
English, Brazilian Portuguese, Chinese, French, German, Hawaiian, Irish, Italian, Japanese, Russian, Spanish and Ukrainian.
The new--lang=LANGgeneral option (also usable in config files) selects one, for report titles, headings, month names etc;
--lang=autochooses based on your system locale.
Gaps in human translations are filled by machine translations, which are marked for review.
Native speakers' help is welcome; see https://hledger.org/TRANSLATING.html.
(Arthur Cinader, Daniil Iaitskov (Russian), Diego Depaoli (Italian), Henning Thielemann (German), Chunhui Ouyang (Chinese), Simon Michael, #2736) -
You can add or override a translation by installing a gettext PO file at
$XDG_CONFIG_HOME/hledger/locale/LANG.po; no compilation is needed.
hledger --write-lang=LANGwrites the current po file for a supported language, or a starter file for a new language, there.
Error messages
-
More error messages use the standard layout, with a position and an excerpt, and are detected correctly by editor addons like
flycheck-hledger and flymake-hledger (which have been updated). Single-line positions show the line number just once (FILE:5, not FILE:5-5).
Errors about a posting followed by comment lines now mark the correct line. -
Very long "expecting" lists in parse errors are abbreviated, and errors inside a cost amount are reported more specifically.
-
Balance assertion failures show a better troubleshooting command: it ends the register at the assertion (
-e), shows zero-amount postings (-E),
uses the more precise--ignore-assertions, and escapes or quotes special characters properly.
Getting data in
Data entry
-
add's default amounts are better: they are shown with the journal's commodity display styles; they are not shown
with ambiguous digit group marks (like1.000); and useful defaults are offered after entering a balance assignment.
It weights similar transactions by their distance from today, not from the journal's latest date, so a future-dated typo doesn't skew the defaults.
(#2645, #2656) -
Fixed:
addno longer saves an entry which would make the journal unreadable.
It now runs all enabled journal checks with the new entry (eg lots must be valid, and with--strict, the strict checks must pass),
and if there's a problem, it shows the error and goes back a step, so you can correct the entry.
Likewise if the entry doesn't balance or fails a balance assertion, it no longer restarts at posting 1.
(#2869) -
addandimportnow test for faulty filesystems before writing.
Some filesystems, eg an Android shared filesystem in Termux, overwrite when told to append;setupwarns about this too.
(#2577)
Data import
-
A new
initcommand creates starter files for a new hledger setup, in the current or a given directory.
--layoutselects from several file layouts:simple(one journal file),
default(separate account/commodity/payee declaration files, data/prices/rules directories, startergetscripts and csv rules),
oryears(a journal file per year, combined by all.journal).hledger init FILE.journalwrites just one self-contained journal.
Existing files are never changed, so init can be re-run to restore missing files.--dry-runshows what would be created. -
getis a new command for fetching transaction data and market prices. It runs two helper scripts which you can customise:
data/getdata, to gather data (eg CSV) files indata/, andprices/getprices, to download market prices intoprices/,
next to the main journal file.--transactionsor--pricesruns just one of these. Sample scripts are in the hledger repo's bin/ directory,
and are installed byhledger init.getpreserves the format of existing prices when merging new ones. -
importwith no file arguments now reads all the.rulesfiles in therules/directory next to the main journal file.
(Files whose name begins with.or_are skipped; this is useful for included files.)
Andimport -g/--getrunsgetfirst. So a complete import workflow can be:hledger import -g [--dry-run]. -
The CSV
sourceandarchiverules now use the journal'sdata/directory by default:
sourcelooks for bare file names and relative paths first indata/, then in~/Downloads
(paths beginning with./or../are still relative to the rules file);
andarchivesaves todata/archive/(previously, a data directory next to the rules file). -
More than one
sourcerule in a CSV rules file is now an error, suggesting to
use one rules file per data file. Previously all but onesourcerule was silently ignored.
(#2862) -
Fixed:
importno longer writes entries which would make the journal unreadable.
It now runs all enabled journal checks with the new entries (eg balance assertions, valid lot movements,
and with--strictthe strict checks), and if there's a problem, it shows the error, writing nothing.
(#2869) -
Fixed:
importwitharchiveenabled and multiple downloaded copies of the source file now deletes processed files and always makes progress
(it could stall, reprocessing the oldest file); it archives only when new transactions were actually imported;
andimport --dry-runno longer archives data files when the flag is abbreviated (--dr). -
CSV error messages are much improved. They show the CSV file and record position with an excerpt; the record's field values with their numbers and names;
the rules file, where each field's rule was defined, and any rules it overrode;
and if an entry converted from CSV is rejected later (eg by balancing), the record it came from.
--debug=2output for CSV reading is clearer, and shows the if rules that matched each record, with their file and line number. -
CSV rules can transform values by calling functions in
%{...}expressions:
upper, lower, capitalize, trim, negate, abs, concat, default, replace, substr, join.
Eg%{capitalize(%desc)},%{default(%payee, %desc)},%{replace(%desc, "ref#[0-9]+", "")},%{join(", ", %note, %ref)}. -
In CSV rules, a hledger field's value can now be referenced in field assignments. So you can eg append to a comment, building it up from several if rules.
And a%(FIELD)interpolation syntax with parentheses is accepted, useful when the field name must be delimited from adjacent text
(account1 assets:%(type)checking). -
CSV amount values can be amount expressions, like
amount1 %price + %fee, as in journal format.
A value counts as an expression if it contains an operator: a*,/, or a+or-which is not a leading or exponent sign.
Within an expression, parentheses group (so-(%price + %fee)is the sum negated).
If there's no operator, values follow the traditional sign conventions (eg parentheses mean negative). -
CSV rules'
currencyandcurrencyNnow set a default commodity, like aDdirective, instead of prepending text to amounts.
So amounts which already have a commodity symbol keep it (previouslycurrency $with€7gave a$€commodity).
The value can be an amount showing the symbol's position and spacing, likecurrency 1 USD;
its number style (eg1.000,00 EUR) is used as the commodity's default display style.
A value which is not a commodity symbol or amount, likecurrency 123, is now an error.
Rules that worked before give the same output as before. -
In CSV rules, if tables can use a new
ifskeyword, which allows aligning their delimiters (ifstill works).
The header line can have spaces around field names, spaces around values are ignored, and a blank value no longer assigns that field.
Comment lines and blank lines can be used inside if blocks, and comment lines inside if tables can be indented.
But*at the start of a line no longer begins a comment (previously a matcher line beginning with*was silently ignored, disabling the if block). -
A new
mergerule combines several CSV records into one transaction.
merge(ormerge N) appends the next record(s) to the current record, naming their fields with a _ROWNUM suffix:%description_2,%4_2, etc.
This is useful for banks and brokers which export a currency conversion or stock trade as multiple rows. -
In CSV rules, when a setting like
date-formatorseparatoris declared more than once, the last declaration now wins, as the manual says,
rather than the first (except forskip, where the first still wins).
So an included rules file's settings can be overridden by declarations after theincludeline;
if you declared one before anincludeto override the included file, move it below.
(#2539) -
CSV rules files'
includedirectives are handled more robustly: include cycles and unreadable files are reported properly;
errors in included files are reported at the right file and line; and included files handle BOMs and CRLF line endings.
(#2537) -
In CSV data, characters which journal format can't represent are now replaced, with a warning:
a semicolon in a description (which would start a comment) becomes.,, and a right parenthesis in a transaction code becomes].
(#2413) -
A CSV rules file's data-generating command (
source | CMD) failing no longer aborts the whole run; it warns and continues, as if no data was found.
So whenimportprocesses several rules files, one flaky source won't block the rest.
When asourcecommand is run, the message names the rules file responsible. -
Fixed: a CSV rules
source | CMDcommand no longer reads hledger's standard input, which could hang or consume input meant for something else.
A#in asourcerule now always starts a comment, even after|. On Windows,sourcepaths with a drive letter are recognised as absolute. -
filesis more useful for tools which need to know a journal's input files:
-t/--treeshows the include hierarchy; it also lists the CSV rules files and data files used;
-O jsongives each file's path, depth and parent; and it no longer processes the data, so it works with journals
that have errors other than syntax errors, and a missing included file gives just a warning.
Journal format
Accounts
-
Account directives can now declare account aliases with
alias:tags.
Egaccount assets:bank:checking ; alias: checkingis like writing analias checking = assets:bank:checkingdirective at that point.
A Ledger-style indentedalias NAMEsubdirective is also accepted. -
aliasdirectives, subdirectives and tags are now applied beforeapply account, as in Ledger,
so that a file's aliases keep working when it is included underapply account.
If you hadapply account Xand thenalias X:foo = ..., that alias should now be writtenalias foo = ....
--aliasoptions still apply last, to the full account names.
(#2733) -
Account names with an empty part are now an error: they can no longer begin or end with
:, or contain::.
Such names caused confusion and wrong reports (egbsomitted an empty top-level account, anda:b:was a different account froma:b).
This is checked in journal, timeclock and timedot files, CSV rules, and the add command and hledger-web's add form
(but not in names produced by aliases or--pivot).
(ledger#3348) -
Fixed:
apply accountignores a trailing colon, as in Ledger:apply account Assets:now givesAssets:Bank, notAssets::Bank.
(#2858) -
Fixed:
end aliasesalso cancelled--aliasoptions, for the rest of that file and the files it included. -
check accounts (and strict mode) no longer require declaring the accounts that hledger chooses for generated postings.
check tagsnow also checks commodity directives' tags;aliasandlotsare built-in tags. -
Fixed: a subaccount-inclusive balance assignment like
a =* $0could also change other commodities' balances in subaccounts.
(#2772) -
There are three new account types: Gain (
G), a subtype of Revenue, for capital gains;
Imbalance (M), a subtype of Equity, for--infer-imbalance; and UnrealisedGain (U), a subtype of Equity, not currently used.
When several accounts are declared with the Gain or Conversion type, generated postings use the first declared. -
Account names whose final part is enclosed in curly braces, like
assets:{foo}, are lot subaccounts,
and must contain a valid lot name (unless-I/--ignore-lotsis used).
Commodities and amounts
-
Numbers can now also use
_or'as digit group marks.
(Kevin F. Konrad, #273, #1489) -
With a
decimal-markdirective (or CSV rule) in effect, a number using a different decimal mark,
or using the declared mark more than once, is now an error.
(#1985, #1904) -
Amounts which hledger infers no longer affect display precisions, or entries' balancing precisions.
So an unseen high-precision balancing amount, eg inferred from a precise@cost, no longer makes it harder to balance the entry;
some reports that used to add unnecessary decimal zeros no longer do so;
and reports more consistently show amounts smaller than their commodity's display precision as0. -
Posting amounts, and costs, can now be written as arithmetic expressions, like
$50.20 + $16.54,$800.00 * 1.05,($92.00 + $15.00) / 3
or1 GBP @ (1 / 1.14 EUR).+,-,*,/and parentheses are supported.
The results of*and/are rounded to the entry's decimal places (costs are kept exact).
To avoid clashing with these, an unquoted commodity symbol can no longer begin with(when written before the number,
or with/when written after it.
See Amount expressions in the manual.
(Martin, #2648, a bounty funded by James Shubin; #2856, #2857) -
Commodity directives can now declare commodity aliases, with
alias:tags: other symbols (or units) for the same commodity. Eg:commodity USD 1.00 ; alias: $, alias: US$, alias: "US dollars" commodity h 1.00 ; alias: 60 minAmounts written with an alias are converted to the canonical commodity when read (print shows them as written;
print -xshows them converted),
so eg$100and100 USDare the same thing, and can balance each other.
An alias can have a multiplier, for differently-sized units.
Aliases are also used as a last resort exchange rate by-V,-Xand--value, in all file trees;
prices --show-aliaseslists these rates.
This is useful eg when your journal and your downloaded price data use different symbols for a currency. -
A repeated commodity declaration (in the same file, an included file, or another
-ffile) now adds to the earlier one, instead of replacing it:
aliases are combined, a display style replaces the earlier one only if given, and later tags take precedence.
With several-ffiles, the last file's display style is now used (previously the first's);--debug=1shows any that differ.
Transaction balancing
-
Transaction balancing errors are clearer, and show the summed amounts.
When rounded amounts being compared look identical, more decimal places are shown.
(#2636) -
--txn-balancing=exact|oldis now--txn-tolerance=entry|display, meaning "balance transactions within
the entry's precision" (preferred) or "within display precision" (deprecated; lets you postpone fixing old journals).
The old spelling still works. -
Fixed: an inferred unit cost could be shown with too few decimal places (eg
@ 33.33 B),
soprint -xoutput could be rejected as unbalanced when read back.
Now it is shown exactly, or with 8 decimal places if it's a repeating decimal.
In other cases too, print shows repeating decimals with 8 decimal places, not 255. -
Fixed: in entries with balance assignments,
check balancedand strict mode didn't catch implicit commodity conversions,
and--txn-balancinghad no effect. -
--infer-imbalanceaddsequity:imbalancepostings to exactly balance entries which are
balanced only when rounded to the entry's precision (eg because of a rounded@cost).
So totals at cost become exactly zero, and the accumulated imbalance can be seen.
The new Imbalance (M) account type can be used to select a different account.
Other journal features
-
One or more adjacent comment lines directly above a transaction (a "preceding comment") are now considered part of the transaction,
and are shown when it is printed. -
Journal files can now
includeCSV/SSV/TSV files, or CSV rules files.
include FILE.csvuses a nearby FILE.csv.rules file; for more flexibility, include the rules file and specify the data with asourcerule. -
apply yearis now scoped, as in Ledger:end apply yearrestores the previous default year,
so following year-less dates no longer get the block's year.
apply yearblocks can be nested, and one left open lasts until the end of its file.
Anend apply yearwith no matchingapply yearis now an error.
(Previouslyapply yearwas a deprecated alias forY, andend apply yearwas ignored.)
A bareendorend apply, and an unmatchedend apply account, give clearer errors.
(#2852) -
A
date:ordate2:tag with an empty value in a posting comment is now accepted, setting no date. This helps when reading Ledger journals.
Assert rules
-
The new
assertdirective declares rules, written as queries, which hledger checks whenever it reads the journal,
like balance assertions. Eg:assert none daily type:A balance:<0 ; no asset accounts are negative at end of day assert some monthly income:salary ; there's a salary transaction every month assert none expenses:petty amt:>+500 ; no single petty expense exceeds 500Each rule's query is run as
hledger bal -E QUERYwould run it, over the whole journal,
or in each period of its period expression, and must match no rows (none) or at least one row (some).
The newbalance:andchange:terms (see Queries) can be used to test the rows' balances and changes;
otherwise, a rule is about which postings exist.
A periodic rule can be followed by indentedskiplines, naming dates or periods to skip checking.
Assert rules are part of the assertions check:-Idisables them,-sorcheck assertionsre-enables them.
Their scope is the file tree they are declared in.
When a rule fails, the error shows every period in which it failed, some of the matching balances, changes or postings,
and a report command to see more.
(#1738, #2719) -
hledger checkcan also check assert rules given as arguments, eghledger check 'assert none daily type:A balance:<0'.
This is handy for trying out a rule, or for rules you don't want to keep in the journal. -
These replace the hledger-check-fancyassertions add-on script, which is removed.
Ledger-styleassert EXPRdirectives, which hledger used to ignore, are now an error unless adapted to hledger's syntax.
Time logging
-
In timedot files, a line whose first word looks like a date is now always parsed as a date line, with a clear error if the date is invalid
(instead of being silently treated as a comment or a zero-amount entry).
Lines with an org heading prefix (eg**) are parsed more consistently. -
Fixed: timedot's
moandyunits were 7 times too large; now they are 30 and 365 days, as documented. (Wrong since hledger 1.4.) -
Fixed: timedot and timeclock durations are no longer rounded to 0.01 hours, so totals don't drift,
and a timeclock session crossing midnight no longer loses a second.
Investments
Lot tracking
-
hledger can now track investment lots and calculate capital gains.
It tracks each purchase's cost basis, infers and validates lot movements across transactions and accounts,
and calculates (or checks) the gain or loss when you sell. In brief:-
Lot tracking is enabled for a commodity by a
lots:tag on its commodity directive;
or lot postings are recognised by a cost basis annotation, or an explicit lot subaccount.
Lot calculation and checking is done whenever such entries are present;--ignore-lots(or-I, which now also means this) disables it. -
Cost basis is written as
{DATE, "LABEL", COST}, with all parts optional.
Ledger's{COST} [DATE] (NOTE)syntax is also accepted.{{TOTALCOST}}is supported.
Cost basis ({}) and transacted cost (@) are each inferred from the other, so writing either is often sufficient.
In an acquisition, if both are written, they must agree. -
Postings are classified as acquisitions, disposals, transfers or gains.
Disposals balance at cost basis, with a single realised gain posting, which can be written (and is checked) or left out (and is inferred);
this is historical cost accounting, preserving the accounting equation.
Gain accounts are detected by the new Gain (G) account type, declared or inferred from names likerevenues:gainorincome:capital-gains;
revenues:gainis used by default. -
Lots are selected for disposal or transfer by a reduction method, set with the
lots:tag's value, per commodity or per account:
FIFO, LIFO, HIFO, AVERAGE, or the all-accounts variants FIFOALL, LIFOALL, HIFOALL, AVERAGEALL.
Or you can select lots explicitly, with a cost basis annotation.lots: NONEon an account opts it out (eg for tax-sheltered accounts). -
Transfers between accounts preserve lots' identity and cost. Many forms are understood: multiple sources or destinations,
elided amounts, fees (priced or unpriced; a priced fee is split off as a small disposal), and transfers into AVERAGE pools, which are re-averaged. -
Short positions are supported, as lots in a Liability account, where a negative posting opens a lot and a positive one covers it.
(#2756) -
Internally, each lot has its own subaccount, like
assets:broker:{2026-01-15, $50}. These are hidden by default;
the--lotsflag shows them in any report, and you can also write them explicitly.
close --clopen --lotscarries lots between yearly files. -
printshows lot postings with an explicit cost basis, so its output is re-readable;print --lotsshows the per-lot postings,
and the newprint -a/--allshows everything useful for troubleshooting (--explicit --lots --verbose-tags).
--verbose-tagsshows lot postings'ptypetags (acquire, dispose, transfer-from, transfer-to, gain). -
-B/--value=costconverts lot postings at their cost basis, so for lot balances it shows the cost of the units still held, andbse -Bbalances.
--value=transactedgives the old-Bbehaviour (proceeds and net cash invested).--gainshows value minus cost basis.
(#2751) -
The
lotscheck which validates lot movements, usually run by default, can also be run byhledger check lots.
Lot errors show the entry as written, how hledger interpreted its postings, and eg the lots actually available.
Balance assertions on lot subaccounts can't be checked reliably, and are ignored when lot detail is hidden; the manual explains.
See "Lots and capital gains" in the manual, and https://hledger.org/start-tracking-lots.html.
(#2581, #2636, #2649, #2724, #2731, #2839, #2843, #2866) -
Holdings
-
The new
holdingsreport shows your lot-tracked investments' performance, per account and commodity, or per lot (--lots),
with units, unit/average cost, current price, total cost and market value, portfolio weight, unrealised and realised gains (UGain, RGain), age,
and XIRR annualised return. Multiple cost and value commodities are shown separately, or converted to one with-X COMM.- In tree mode, accounts with subaccounts or several commodities are heading rows showing their subtree's totals.
(Arthur Cinader, #2779) - With a report interval (eg
-M), it shows the totals at each period end, up to today, titled eg "Monthly holdings";
--change,--cumulativeor-Hselect whether the gain columns show gains during each period, since the report start,
or since acquisition (the default). - When the report period has a start date (
-b,-p,date:), the gain columns show the gains during the report period.
Eghledger holdings -p todayshows today's gains. - When some holdings have no market price, the totals show the others' value and gains, and a note names the ones excluded.
- When closed positions (fully disposed commodities or accounts) are hidden, as they are without
-E,
a note says how many, since the RGain and XIRR totals include them. balance:andchange:queries can select holdings by units, value, or (with-B) cost, egholdings balance:'>$1000'.-S/--sort-amountsorts holdings by Total value, largest first, with unpriced holdings last (or with-B, by Total cost).- With colour, gains are green and losses red.
- It has csv, tsv, html, fods and json output, and can show charts.
- In tree mode, accounts with subaccounts or several commodities are heading rows showing their subtree's totals.
Reporting
Queries
-
A new "find anywhere" query, written
find:PATTERNor::PATTERN, matches a regular expression in any of a transaction's fields
(code, description, comment, tags including hidden and inherited ones, account name, or amount);
and if PATTERN is a period expression, it also matches dates in that period.
This allows many queries to be written more briefly, especially when you're not sure where some text might be.
Eg::2025 ::foodmatches things in 2025 (or mentioning "2025") and mentioning "food". -
amt:can now include a commodity symbol, to compare only amounts in that commodity:amt:'>$100',amt:'<200 EUR'.
This is easier than adding acur:term, which needs regular expression escaping (cur:'\$' amt:'>100').
The manual is also corrected:amt:without a commodity symbol matches multi-commodity postings if any of its amounts match. -
any:andall:queries now also work in posting-oriented reports like register, balance and aregister;
previously they had an effect only in commands which show whole transactions, like print.
So those reports can now select postings based on their siblings: eghledger balance expenses any:cashshows expenses which were paid with cash. -
Queries like
desc:or::, with an empty pattern, now match anything. (Previously they gave an error.)
date:query parse errors now show the actual error. -
accountsnow respects transaction-specific query terms such asdate:,status:,desc:; these no longer match a declared but unused account.
(Onlyacct:,depth:,type:ortag:can match one.)
payeeslikewise; andpayee:now matches declared payees. -
New
change:andbalance:query types match report rows by their summed amounts,
unlikeamt:which matches individual posting amounts.
change:tests a row's change (the sum of its postings);
balance:tests its historical balance at the end of its period.
Eg:hledger bal expenses change:'>+100' # expense accounts where more than 100 was spent hledger bal assets balance:'<0' # asset accounts with a negative balance hledger reg gifts -M change:'>100' # months with more than 100 in gifts hledger areg checking balance:'<0' # transactions after which checking was overdrawn hledger print not:change:0 # entries with a tolerated imbalance or unbalanced virtual postingsAs with
amt:, a commodity symbol (change:'>$100',balance:'<0 EUR') compares just that commodity.
And an unsigned number tests the magnitude, ignoring sign (sochange:'>100'also matches a change of -150),
while a signed number (or 0) does a signed comparison (egchange:'>+100',balance:'<-500').
Amounts are tested with their real sign, as shown bybalance(not the adjusted sign shown by--invertorbs/cf/is).
balance:always means the historical balance, ie calculated from the start of the journal (with or without-H).
In balance reports, non-matching accounts are left out, as with an account query, so parent balances and totals include just the matching accounts.
Reports
-
A new
transactions(tx) command lists transactions on one line each. It's like print, but better for a quick overview. -
registerwith no report interval now hides zero-amount postings unless-E(or--average) is used,
like register with a report interval, or aregister.
(#2836) -
balancehas a new--full-namesflag, which in tree mode shows full account names;
--no-elidenow also works in list mode, adding the parents of the posted-to accounts;
and a newbarewidelayout shows bare numbers with a column for each commodity.
(Henning Thielemann, #2429, #2661) -
aregisternow supports-A/--average, showing the running average change per transaction instead of the running balance;
and a new--matchedflag, which shows the matched account(s) in each row instead of the other account(s) (the opposite of-r/--related).
(Caleb Maclennan, Simon Michael, #2540) -
Report titles can be customised:
--title=TITLEsets a title for most reports (in txt, html or fods output),
--subreport-titles='TITLE1|TITLE2|...'sets the section titles of compound reports likebalancesheet(eg--subreport-titles='Aktiva|Passiva'),
and--period-titles=compact|datesselects abbreviated or full ISO dates as column headings in periodic reports.
(#2578) -
HTML output is improved: with
--base-url, every balance report amount links to the corresponding register view, so you can click to see
where an amount comes from; CSS classes are used instead of inline styles, with classes for negative amounts, amounts, dates, and tree depth;
dates and amounts don't wrap; ahledger.cssfile now overrides the builtin styles (an example is provided);
register, aregister and holdings show a title too; and there are newlines between elements, for readability.
(Arthur Cinader, Simon Michael, #2326) -
The
commodities,tagsandpayeescommands have a--directivesflag, which shows directives ready to paste into a journal.
(Use it with--undeclaredto generate directives satisfying strict mode.) -
commodities --usednow shows only commodities used in transactions; a new--pricedflag shows commodities used in P directives.
commoditiesnow supportsdate:queries (and report period options) with these, andtag:queries. -
priceshas a new--summarymode; a--locationsflag, showing where each price came from;
--show-aliases, showing the rates implied by commodity aliases; and it can be filtered byfind:queries. -
Repeating the
--transposeflag now toggles it. In--pivot's value,accountis accepted as a synonym foracct.
A two-year interval's report title now says "Biennial", not "Biannual" (Arthur Cinader). -
Fixed, in balance: multi-period reports using
--treeand--transposetogether now show only the leaf accounts (#1941, JoeJoeflyn);
in single-period csv/tsv/html/fods output,--dropno longer truncates the "Total:" heading (#2688);
single-period HTML/FODS reports respect the commodity display style (Simon Michael, Henning Thielemann, #2584, #2588);
FODS multi-period and compound reports have the correct number of header columns (Henning Thielemann);
and in single-period text reports, account names stay aligned when amounts are wide (Adam Sardo, #1148). -
Fixed, in register: with a report interval, account-specific depth limits (
--depth REGEXP=N) now work correctly (#2423);
with multiple files, the transaction indexes in csv/tsv/fods/html/json output continue across files instead of restarting;
and postings whose amount couldn't be inferred are omitted (#2571). -
Fixed, in aregister: with historical balances, a
date2:start date in the query is now honoured (Arthur Cinader). -
Fixed:
balance --budgetreports no longer lose their goals when the command includes transaction or posting filters,
such asstatus:,desc:or--cleared. Only the attributes that meaningfully select goals (account, account type, depth, date, commodity) affect them.
Sobal --budget --clearedcompares cleared spending against the full goals.
(#2545) -
Fixed:
--countreports showed counts in the journal's no-symbol commodity style (eg 1.00), rounded their averages to whole numbers,
and bs/bse/is showed negative counts in some sections. Now counts are whole numbers, averages have one decimal place,
and bs/bse/is show positive counts in every section, with their sum as the net total. -
Fixed:
--value=WHEN,with nothing after the comma now values in the no-symbol commodity (previously it was read as--value=WHEN).
-Xand--valuealso accept a double-quoted commodity symbol, so""also selects the no-symbol commodity.
And-X/--valuewith a commodity to which no conversion price can be found now prints a warning, instead of silently having no effect.
(#2844) -
Fixed, in stats: the elapsed time and txns/s figures once again cover the whole run (since 1.51 they covered only the journal-reading phase).
--oneline(formerly-1) has a-qshort spelling, and it and-1/--depth 1now work independently.
stats is faster on large journals, and shows a base currency inferred for the journal, eg$ (USD). -
Fixed: roi's TWR is now computed from the investment's value at the end of each day, exactly, at daily granularity.
The previous method assumed an exact valuation was available around each cash flow, and its solving could fail.
Results change for most journals with cash flows between valuations; if you record valuations only occasionally
(eg with--pnltransactions), record one around large deposits and withdrawals.
Also, cash flows are now measured from the investment's perspective (other postings in the transaction, eg fees, no longer affect them),
a holding without a market price is valued at the price of its latest purchase or sale, the value at the end of a period uses the prices of its last day,
and--cashflowshows each cash flow and the TWR steps, for checking the results. These can change IRR results too. See the roi docs.
(Dmitry Astapov, #2420, #2824, #2825) -
Fixed: in roi, a failed IRR or TWR now shows "error" in its own cell, with the rest of the report still shown,
and the reasons shown as a warning after the report (with exit status 0).
Some special cases now have an answer instead of an error: when money is put in and nothing comes back (eg a write-off), IRR is -100%,
and same-day cash flows that add up to zero have an IRR of 0%.
And omitting--pnlnow selects no postings, as documented; previously it selected all postings.
(Dmitry Astapov, Arthur Cinader, #2670, #2845)
Charts
-
hledger now has easy charting built in. Most reports can be shown as charts, with
--chart.
In the terminal, these are bar charts, using colour and Unicode block characters when supported.
Charts adapt to the report options and data, showing subperiods, stacked bars, end balances,
contra amounts hatched, largest amounts prioritised, totals/averages, etc. Each commodity gets its own chart.
If csv, tsv or json output is selected, the chart's data is shown instead. -
When colour is available, accounts are coloured by type: assets blue, liabilities amber, equity violet, revenues green, expenses red,
with each account of a type in a different shade. Accounts of unknown type get distinct colours. -
--viewopens a report in the system's default viewer for its format.
It writes an output file if you didn't specify one (in hledger's cache directory), choosing html format if you didn't specify that.
Eghledger is -M --chart --view, orhledger is -M -o is.fods --view. -
Charts can also be SVG images, with tooltips and light/dark variants, selected by the new svg output format (
-O svgor-o FILE.svg).
Or, SVG charts can be added to html reports (-o FILE.html --chart).
(Simon Michael, Arthur Cinader) -
In compound reports like bs and is, all accounts are stacked in one bar per period, on opposite sides of the axis (the diverging layout);
--chart=groupedshows each section's accounts in a bar of their own, side by side, asbalance --chart=groupeddoes for each account type.
--chart=netalso draws the net total.--chart=SCALE(eg--chart=5000) draws charts at a fixed scale,
so that separate charts can be compared. These can be combined, eg--chart=grouped,net,5000. -
holdingshas a chart, showing a horizontal bar per holding (or lot) with its cost basis, unrealised gain or loss, and gain percentage;
or with a report interval, the cost basis and value per period (or with--changeor--cumulative, the gains).
activitynow shows a chart of transactions per week, using the new chart engine;--postingscounts postings, per account.
It now supports-w/--width,-S,-T,-A, and svg, html, csv, tsv and json output.
print, exporting
-
printnow aligns posting amounts at their decimal marks. The target column is 53; it is increased when needed.
Balance assertions' operators and amounts are aligned too.
A new--layoutoption (also supported byadd,close,import,rewrite) customises this:
--layout=COLsets a different target column, and--layout=hledger1gives hledger 1's layout. -
In
print's csv/tsv/html/fods/sql output, the debit column now appears before the credit column, following convention.
Inaregister's csv/tsv/html output, the "change" column is renamed "amount", matching print's, for easier re-importing. -
print --exportreproduces the whole journal losslessly, preserving directives, comment lines and blank lines,
for easier reformatting or exporting. Included files are inlined.
With--forecastand/or--auto, the generated transactions and postings are exported instead of their rules. -
printhas a newledgeroutput format (-O ledgeror-o FILE.ledger), which uses Ledger's lot syntax,
and with--export, comments out directives which Ledger does not support. Its default format is now called "journal" ("txt" is still accepted). -
print's beancount output is improved. With--export, it generates the directives Beancount needs (options, commodity, open, prices),
and accounts whose top-level name is not one of Beancount's are prefixed with one based on their account type, if known.
It converts single-letter commodity symbols, the no-symbol commodity, top-level "revenue(s)" accounts, balance assignments and market prices;
it sets booking methods from accounts'lotstags, and shows cost basis before transacted cost;
underscores in account names become dashes rather than being hex-encoded (#2596); and non-ASCII letters in tag names are encoded (#2576). -
rewrite --diffoutput can now be applied bypatchorgit apply: each source file is diffed as a whole, with three lines of context.
And changed transactions which have no journal entry to patch (eg ones read from CSV) are left out of the diff and reported on stderr.
(#2548)
Other commands
-
setupdetects terminal colour support and explains its verdict; warns if the filesystem does not support appending (#2577);
checks for Gain accounts; no longer reports unused commodity aliases as undeclared; and no longer shows an error message on Windows. -
check: an unknown check name is now reported right away, instead of after reading the journal.
check ordereddateswith--forecastnow ignores forecast transactions. -
accounts --show-aliasesshows each account's aliases, as a comment, and makes account name queries also match aliases.
accounts --locationsnow also shows where undeclared accounts were first used, and shows locations as FILE:LINE.
Whencheck accountsfinds an undeclared account name which is an account alias not in effect there, the error explains alias scope. -
closeno longer generates a spurious zero posting for some emptied accounts.
Performance
-
hledger has been optimised, and this is the fastest and most memory-efficient version yet.
On medium and large journals,balanceis 2-3x faster than 1.52, and uses a third less memory.
Unnecessary work is avoided, so you pay only for the features you are using.
Detailed stats, performance tips, and a new set of benchmarks comparing the plain text accounting apps, are at https://hledger.org/PERFORMANCE.html. -
Interval reports no longer slow down quadratically with the number of periods (a daily register over 100 years spent 2.5s in that alone),
and register and--forecastuse constant memory however many periods there are.
(#1683) -
Regex replacement no longer takes quadratic time in the length of the text; long texts (eg regex aliases on 2000-character account names) are much faster.
check accounts, check payees and check tags are faster with many declarations (eg 0.63s -> 0.20s with 10k transactions and 10k declared accounts).
Journals with many balance assertions or quoted commodity symbols are parsed faster, journals with lots are processed faster,
and tables with many-line cells (eg register with a many-commodity running balance) are rendered faster (Dmitry Astapov). -
hledger no longer searches PATH for add-ons when the command is a builtin command, for faster startup (eg
hledger --versiontakes 23ms instead of 32ms). -
hledger release binaries are built with megaparsec 9.8.3, which contains our fix for a performance regression in megaparsec 9.3 to 9.8.2,
making hledger about 10% faster. Packagers who want the speedup should use megaparsec 9.8.3+. -
--debug=1now prints a timing line for each phase of hledger's work, with its run time and allocation,
and shows how much of the journal was parsed by the new fast-path parser.
Other
Packaging and API
-
hledger now requires aeson 2.2.5.1 or newer, avoiding a bug where certain data could trigger memory/CPU exhaustion
(https://haskell.github.io/security-advisories/advisory/HSEC-2026-0007.html).
megaparsec 9.8.0 is excluded, to avoid a position marker bug in error messages (megaparsec#572).
hledger no longer depends on lucid; blaze-html is used for HTML output (Arthur Cinader, #2737). -
hledger's source tarball no longer ships the benchmark suite's 1.6MB journal.
-
Haskell API changes in the hledger package: Hledger.Cli.Anchor gains LinkOpts and link builders;
Balance exports its report specs, spreadsheet parts and titles, with shared functions in Balance.Internal;
balanceReportAsText returns Text; setDisplayCommodityBare's parameters are swapped;
Hledger.Cli.Xirr is the IRR solver shared by roi and holdings.
(Henning Thielemann, Arthur Cinader, Dmitry Astapov)
Examples
- examples/file-layouts (formerly examples/templates) has simple, default, years and year-dirs layouts;
hledger initwrites the first three. - examples/lots/ has lot tracking examples: lots.journal, irr.journal (comparing roi and holdings XIRR),
and investments-5y.py, which generates a large investment journal. - examples/csv/ has new rules for PayPal (json), Kraken (demonstrating
merge), SimpleFIN, Unify Federal Credit Union and GitHub sponsorships. - examples/home-page-example.journal is the example from the hledger.org home page.
- hledger.conf.sample is updated, with command-listing helpers and a custom
watchcommand. - bcexample's beancount prices are converted to P directives, so
-Vworks. - examples/hbcexample.journal is a copy of bcexample.journal with current dates and valid hledger 2 lot entries.
Scripts/addons
getdataandgetpricesare sample scripts for thegetcommand;krakencsvhelps convert Kraken CSV.git-pre-commit-hookis an example git hook which runshledger checkon your journal when its files are being committed.hledger-barallows its flags anywhere among the arguments, and sets the scale with a new-soption.- hledger-check-fancyassertions is removed, replaced by assert rules. The hledger-example* scripts are renamed and updated.
- bashrc: holdings and tx aliases.
Docs
- The hledger manual is reorganised, with more getting started info at the start; Options and Config files consolidated;
COMMANDS moved before DATA FORMATS, and grouped like the commands list; detailed command line tips moved to PART 5;
and a shorter, better grouped topic list in the website sidebar. - New sections include: Lots and capital gains (with Recording disposals, Troubleshooting lots and more), Charts, Languages,
Amount expressions, Commodity aliases, the assert directive, Transaction balancing, Report titles, print layout, Built-in tests,
and hledger 1 and hledger 2 (on migrating and interoperating). - The CSV docs are reorganised, with clearer explanations of reading the data, finding the data, CSV vs hledger fields, if rules and ifs tables,
and rules examples moved into Working with CSV. - Directives, the alias directive, account aliases, directive scopes and combining file trees are explained more clearly; timedot is rewritten;
Tags, Boolean queries, the two-space delimiter, decimal marks and period expressions are clarified.
(#1640, #1950, #2664, #2665, #2714) - The "added in VERSION" and "experimental" labels are dropped throughout the manuals.
hledger-ui 2.0
All changes since hledger-ui 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
See also the hledger changelog, for changes affecting all the hledger tools
(lot tracking, commodity aliases, the :: find query, translations, faster starts and reloads, etc.)
Highlights
The most notable changes since hledger-ui 1.52; each is described below.
- Watch mode is on by default, with no memory leak, and reloads more robustly. (Breaking changes, Fixes, Improvements)
- The
Lkey shows or hides lot subaccounts and per-lot detail, for journals using hledger 2's lot tracking. (Improvements) - Assert rules are checked on load and reload and when
Ire-enables checks. (Improvements) - Translations: the
--langoption shows the UI in other languages. (Improvements) - The journal can be read from stdin, on unix-like systems. (Improvements)
- And hledger's improvements (more speed, commodity aliases, new queries; see the hledger changelog).
Breaking changes
-
Automatic reloading is now enabled by default: hledger-ui watches for data and date changes, and reloads automatically.
The new--no-watchflag disables this, reloading only with thegkey.
The rightmost--watch/--no-watchflag wins, so a config file setting can be overridden on the command line. -
With more than one of
--cash/--bs/--is/--all/--register, the last one wins,
so a config file's choice can be overridden on the command line. (Previously they had a fixed priority order.) -
--tldris renamed to--examples(see the hledger changelog).
Fixes
-
Fixed a long-standing memory leak (and background CPU use) when reloading in watch mode.
Now watch mode has no extra memory/CPU cost, and can be used freely with large journals.
(#1825) -
hledger-ui gracefully handles more reloading failures,
such as failure caused by a changed CSV file or rules file,
or by a file momentarily removed when your editor saves it.
Instead of quitting, it now shows the error screen, allowing recovery. -
The transaction screen now always shows the whole journal entry.
Previously with acur:oramt:query in effect, it showed the entry without the non-matching postings.
(A long-standing bug, since hledger 1.23.) -
The mouse wheel now scrolls all the way. Previously it moved the viewport at most to the current selection
and then stopped; you had to move the selection with the arrow keys to get any further. -
Pressing
DOWNat the last list item, orC-l(recenter) when near the end of a list,
no longer scrolls into blank padding space; hledger-ui now keeps as many items as possible on screen.
(Juan Wajnerman, #2278, #2593) -
With
--pivot, re-enabling checks withIdid not really recheck them, so failures went unreported. -
On Windows, the
Akey (running hledger-iadd), theEkey (running$EDITOR),
and the running of info/man/tldr/pager helpers now correctly quote file paths containing spaces.
(#2646)
Improvements
-
The
Lkey toggles showing lot subaccounts and per-lot detail (like the CLI's--lotsflag),
for journals using hledger 2's lot tracking.ESCresets it to the startup state. -
hledger-ui checks the new assert rules (see the hledger changelog),
when the journal is loaded or reloaded, and when checks are re-enabled withI.
They always see future-dated ordinary transactions, even when those are hidden behind theFkey.
They see transactions generated by periodic rules only when--forecastis used. -
The new
--langoption shows hledger-ui's menu and accounts screen names in other languages (see the hledger changelog).
The help dialog and the register screen's labels are not yet translated.
(Arthur Cinader) -
hledger-ui can now read the journal from stdin (
-f-), on unix-like systems.
With a stdin journal the data can't be re-read or edited, so theg,a,AandEkeys and watch mode have no effect. -
Changes to CSV rules files now trigger a reload, like changes to data files.
-
The transaction screen now refreshes in place when there's a reload. Previously you had to exit and re-enter it.
(#1825) -
Warnings (eg CSV data warnings, which could appear on every reload) no longer scroll and disrupt the display;
they are shown on the bottom line, until the next key press.
Also the screen is fully repainted after a reload, repairing any other stray terminal output,
and error screen reloading is less flickery and more robust. -
The
Ekey now jumps to the error position with the Zed and Sublime Text editors, also.
(Rostislav Raykov) -
CTRL-cnow quits, likeq, from any screen or mode, including while the help or a minibuffer is open.
Previously it was ignored. -
Clicking a background hledger-ui window now just brings it forward,
without also selecting or entering the item under the pointer. -
The
-?and--webmanflags are added (see the hledger changelog). -
Allow brick 3.x (with 3.1 support from GuillaumedeVolpiano), doclayout 0.6. Exclude megaparsec 9.8.0, to avoid a position marker bug in error messages
(megaparsec#572).
Docs
- The manual's KEYS section is grouped like the help dialog; the depth keys, help dialog keys,
CTRL-zand editor variables
are documented; and the watch mode and BUGS sections are updated.
hledger-web 2.0
All changes since hledger-web 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
See also the hledger changelog, for changes affecting all the hledger tools
(lot tracking, commodity aliases, new queries, translations, faster starts and reloads, etc.)
Highlights
The most notable changes since hledger-web 1.52; each is described below.
- More reports (balance sheet, income statement, cashflow, holdings and more), with options, and new charts. (Reports)
- Paged journal and register views. (Reports)
- A dark mode, and a tidier look. (Appearance)
- Keyboard navigation, like hledger-ui's. (Navigation and keys)
- Translations. (Translations)
- Security hardening. (Security)
- Changes that would make the journal unreadable are refused. (Fixes)
- Less javascript. (Other improvements)
Security
-
hledger-web now sends a Content-Security-Policy header with every page.
This tells your browser to load scripts, styles, images and fonts only from hledger-web itself,
and to run only hledger-web's own scripts; so if anything script-like ever reached a page,
eg through data in your journal, the browser would refuse to run it.
In normal use you should notice no difference.
(Arthur Cinader, #2703) -
hledger-web now sends the
X-Frame-Options: SAMEORIGINandX-Content-Type-Options: nosniffsecurity headers
on every response, so other sites can't frame its pages for clickjacking, and browsers won't second-guess content types.
(Arthur Cinader) -
Nothing is loaded from third parties any more; two dead third-party script tags, and the unused (always disabled)
Google Analytics hook, have been removed.
(Arthur Cinader) -
(The XSS and include-injection fixes of 1.52.2 and 1.52.3 are of course included.)
Breaking changes
-
When listening on a non-local address (set with
--host), hledger-web now allows only read-only access by default.
Add--allow=addor--allow=editto allow changes. -
Startup options and query arguments now set up the opening page, as url parameters,
instead of acting as invisible server-side defaults and filters.
So every view is described by its url, and a shared link shows the same view to everyone.
But a startup query no longer restricts what hledger-web serves:
it becomes the first page's search, which a viewer can edit or clear, and the JSON API serves the whole journal.
To serve a restricted view, serve a restricted file.
(Arthur Cinader) -
Pages are now shown in the viewer's language, when a translation is available (see Translations below).
--lang enkeeps hledger-web in English. -
Some keyboard shortcuts have changed, to match hledger-ui (see Navigation and keys below).
-
In JSON output, postings'
ptypefield is renamed topreal. -
--tldris renamed to--examples(see the hledger changelog).
Fixes
-
The add form, JSON API (PUT /add), edit and upload now refuse a change which would make the journal unreadable.
They check it as the next read (with hledger-web's startup options) would, and on failure leave the file unchanged.
Eg /add can no longer add unbalanced transactions, the add form now checks balance assertions,
and edit and upload now respect--strictand-I.
(#2864, #2869) -
hledger-web no longer exits prematurely when its page is in a background browser tab
(browsers may run background tabs' timers much less often).
Now it exits 15 minutes after its last page is closed (was 2 minutes), and a page pings as soon as it is foregrounded again.
And when a page can't reach the server, it shows a notice saying hledger-web is no longer running and how to continue,
instead of failing silently on the next click.
(Arthur Cinader, #2722) -
The register now shows the to/from account names when restricted by a
type:query, instead of blank cells.
(Arthur Cinader) -
The upload form now shows the name of the chosen file.
(Arthur Cinader) -
/favicon.ico and /robots.txt no longer return 404 when hledger-web is run outside its source directory.
robots.txt now also asks crawlers not to index the site.
(Arthur Cinader) -
Browsers now check for updated scripts and styles, so they don't keep using old ones after an upgrade.
Reports
-
hledger's balance, balance sheet, income statement, cashflow and holdings reports are now available in hledger-web.
Every amount links to the register it is derived from, column headings link to the report for that period,
and a "Report:" row links the report pages to one another.
The balance sheet has Equity as an option, and the balance report is called All accounts, as in hledger-ui.
The holdings report is for journals using lots; in tree mode, accounts are heading rows with subtotals,
and lots fold beneath their holdings. When its report period has a start date, it shows the gains during that period.
It can also show a report interval, likeholdings -M, with a Gains option choosing what the gain columns cover.
Gains and losses are shown in green or red, and thezkey shows or hides closed positions.
(Henning Thielemann, Arthur Cinader, Simon Michael) -
hledger-web now opens on the balance sheet, rather than the journal,
and with a default report interval, chosen to suit the period shown (monthly for up to two years, quarterly for up to six, otherwise yearly).
Pages show depth 1 by default: just the top-level accounts, so that tables and charts start simple and readable.
-and+steps and a List/Tree switch beside a table's Account heading make deeper accounts easy to reach. -
The report pages have an Options panel, offering most of hledger's report options and filters
(report interval, changes or end balances, depth, valuation, lots etc.), so reports can be reshaped in the browser.
The options are kept as you move between pages, and every view has a shareable url.
(Arthur Cinader, Simon Michael) -
Reports show a chart at the top, drawn by hledger's new chart engine (see the hledger changelog).
The Chart and Data buttons, or thecanddkeys, show or hide the chart and the data (persistently),
so you can use hledger-web with either or both visible.
When there's more than one commodity,[and]step between their charts.
Charts are redrawn to fit when the page's width changes, and show their tooltips immediately, also on touch screens.
This replaces the old register chart; jQuery and Flot are no longer used.
(Simon Michael, Arthur Cinader, #2800, #2784) -
The Chart option chooses the Diverging (default) or Grouped layout, and the
Nkey shows or hides the net total line.
The--chartstartup option accepts the same values as the commands'--chart: a layout,net, and SCALE amounts. -
The sidebar now always lists the full account tree, for navigation, whatever the search.
It has its own persistent depth, starting at 1, adjustable with the fold carets, its-and+controls, or a shift-DIGIT key.
Its balances are now hidden by default, making pages with a large journal about twice as fast, and smaller;
clicking the Balances heading, or pressing thebkey, toggles them.
They are now historical balances, as of the report's end date (previously, the changes during the search's period).
A button shows or hides the sidebar, on all screen sizes. -
The journal and register views are now paged, showing the newest 1000 matching transactions and page navigation links.
When the matches span more than one year, a years row links to each year (grouped by decade when there are more than twenty).
Account links from a transaction open the account register at the appropriate page.
(Arthur Cinader, #586) -
The register can start from the balance brought forward (
accum=historical), so its running balance is the account's balance
rather than a total of the transactions shown. The oldest row shows the brought-forward balance, and links to the earlier transactions.
A running balance of many commodities shows just the row's own commodities, eliding the others.
(Arthur Cinader, #2784) -
Tree mode now folds items at the requested depth, and you can click individual items to expand them.
Boring parent accounts are squashed, and the depth limit corresponds to account depth, as on the command line.
In list mode, account names show their parent path dimmed, and a prefix shared by all the accounts is shown once.
(Arthur Cinader, Simon Michael) -
Links in the journal, register and sidebar now behave consistently: an account name opens its view,
an amount opens the register it comes from, and a date narrows to that day.
The sidebar's amounts are now links, and its Journal link keeps the current search.
(Arthur Cinader) -
Report urls are simpler, and queries and parameters are used more consistently,
eg/register?account=assets:bankorinterval=monthly. Old bookmarks still work.
(Simon Michael, Henning Thielemann) -
Search supports hledger's new query types:
::(find:),change:andbalance:, andamt:with a commodity symbol.
The search help is updated. (See the hledger changelog.) -
Percentages that can't be calculated now show plain amounts with an explanation, instead of an error page.
(Arthur Cinader)
Appearance
-
hledger-web now has a dark mode, enabled automatically when the browser or system is in dark mode.
(Arthur Cinader, #2706) -
The journal and register tables have been tidied up: digits in amounts are shown with equal width, so numbers line up neatly
in a column; column headers are small and muted; and the zebra striping is replaced by a faint highlight on the row under the pointer.
Amounts and their commodity symbol no longer break across lines.
(Arthur Cinader, #2718) -
Transaction tooltips, shown when hovering over a transaction in the journal or a register, are now drawn in a fixed-width font,
so amounts and comments line up as in the journal; long lines wrap, and the tooltip stays within the window.
(Arthur Cinader, #2716) -
The sidebar keeps its scroll position when you click an account or navigate, and on wider screens
the sidebar and the main content scroll independently. A long or multi-commodity balance no longer covers its account name.
Pages keep their scroll position too.
(Arthur Cinader, #2679) -
Journal and register headings name the search's dates, like other pages.
-
hledger-web now has its own favicon: a gold coin struck with an equals sign.
(Arthur Cinader)
Navigation and keys
-
Navigation links are now also shown at the top of the page, so you can navigate with the sidebar closed.
(Arthur Cinader) -
gthen a key goes to another page, via a dropdown menu, so you can navigate to most places with the keyboard. -
Keyboard shortcuts for adjusting report options are provided, similar to hledger-ui's.
(Arthur Cinader, Simon Michael) -
a(open the add form) now works on all pages.ftoggles full window mode, showing only the report.
/puts the cursor at the end of the search field.escapeexits the search field or full window mode, in addition to cancelling things.
deleteandbackspaceclear the search, as in hledger-ui. -
nandpgo to the next and previous page;nno longer opens the add form (useafor that). -
Keyboard focus is managed better; after a page load or a search, keyboard scrolling and shortcuts work
without having to click the page first. -
The help popup has been cleaned up, and links to hledger-web's manual on the website.
(Arthur Cinader, Simon Michael)
Translations
- hledger-web can be shown in 12 languages (see the hledger changelog).
The language is chosen by a_LANGquery parameter (which saves a browser cookie), a previously saved cookie,
or the browser's Accept-Language header; or it can be fixed at startup with the--langoption.
See the manual's LANGUAGE section.
(Arthur Cinader)
Other improvements
-
--port 0lets the OS choose a free port. The chosen port is reported in the startup message and used in the default base url,
so scripts can discover it. This works in the default--serve-browsemode too.
(Arthur Cinader, #2559) -
hledger-webs running at different ports on one host remember their own report and display options.
(Simon Michael, Arthur Cinader) -
Changes to CSV rules files now trigger a reload, like changes to data files.
-
The web UI's javascript has been modernised, replacing all the vendored libraries (jQuery, Bootstrap's scripts, Flot and others)
with standard browser features: autocomplete suggestions use a native<datalist>,
the button beside the date field opens the browser's own date picker (typed smart dates like "today" still work),
and the add and help dialogs use the native<dialog>element. Pages load much less javascript.
(Arthur Cinader, #2702) -
The
-?and--webmanflags are added (see the hledger changelog). -
hledger-web now requires wai-app-static >=3.1.9 and yesod-form >=1.4.12, and no longer depends on lucid (#2737).
megaparsec 9.8.0 is excluded, to avoid a position marker bug in error messages
(megaparsec#572).
Docs
- The manual has new WEB UI, REPORTS, URL PARAMETERS and LANGUAGE sections, an updated JSON API section,
and says--allow=edit/--allow=addinstead of the old "capability" terms.
project changes 2.0
All general project changes since hledger 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
For package-specific changes, see the hledger package changelogs.
- The hledger repo has moved to the hledgerorg github organisation: https://github.com/hledgerorg/hledger. Old links redirect.
The main branch is nowmain.
(#2681)
AI usage
- hledger 2 is developed with careful AI assistance: all changes are steered, reviewed and tested by Simon or a contributor.
(If you want software built without any help from AI tools, choose hledger 1.x.)
https://hledger.org/AI.html is our AI policy and FAQ, with the rationale and usage reports.
Commits disclose their AI usage, which is journalled in doc/ai/ (just ai ...shows reports).
First-time contributors' pull requests may not use AI tools. Security fixes for hledger 1 may be backported from AI-assisted fixes, at the maintainer's discretion.
Docs
- New docs:
AI (policy and FAQ),
IMPACT (the project's external impacts),
RULES (repo policies, old and new, in one place),
STYLE (rules for changes to hledger-web's appearance),
TRANSLATING (a guide for translators, and tooling details for developers; Arthur Cinader),
Upgrading to hledger 2, Start tracking lots, Charts (on the website) - New specs and notes:
SPEC-assert, SPEC-balance-change-queries, SPEC-charts, SPEC-finalising, SPEC-holdings, SPEC-lots
(with a tested comparison of lot handling in Ledger, Beancount and hledger), SPEC-print, SPEC-special-postings;
NOTE-performance; PLAN-gain-terms, PLAN-release-2.0 - BENCHMARKS is renamed to PERFORMANCE and rewritten for both users and developers, with performance tips and detailed stats for hledger and other PTA apps
- CHANGELOGS is retired, superseded by RELEASING and the changelogs skill
- CODE: added module maps, reading order, conventions and debug output; queries vs report options; report periods, intervals and date spans
- CONTRIBUTING, DEVFAQ, DEVWORKFLOWS, TESTS and other dev docs: a developer quick start; updated for current tools, scripts and test suites;
general cleanup and consolidation; "last updated" lines added to docs more than a year old
(#2528) - CREDITS, DECISIONS, FINANCE, FUNDING, ISSUES, README: updates
- Install: added Building outside the source tree; the release notes' binary install instructions are fixed and simplified
(#2707) - PULLREQUESTS and the pull request template: many edits, linking to the AI policy
- REGRESSIONS, FINANCE: the regression bounties are discontinued
- RELEASING: consolidated into a single release script, grouped into phases, and revised after each release
- The Ledger and Beancount pages are updated
Website
- hledger.org uses the latest mdbook; pages' tables of contents are in the sidebar;
and the hledger manual's sidebar sections are properly indented, with 10 top level entries instead of 48.
Tools/infrastructure
- AI skills: changelogs, release, credits, translations, binary-badges and regen-shelltests skills help AI assistants with those tasks;
the pcc skill runs hledger's pre-commit checks - ai:
just ai ...recipes report AI usage from Claude Code sessions, commit messages' "AI usage:" lines, and the doc/ai journal - benchmarking: scripts moved into bench/, updated;
just perftest; generatejournal has --start and --days, for sparse and dense journals (Arthur Cinader) - build: git changes now recompile only the GitInfo module (7.8s -> 4.8s for hledger); stack-prof.yaml is a profiling build config;
stack configs use recent nightly snapshots, with GHC 9.14 the default; an experimental hx build tool config - changelogs:
just changelogspre-cleans its drafts (routine commits dropped, AI usage lines stripped, breaking changes lifted to the top,
possible duplicates flagged), and finds its resume point even after a rebase;just changelogs-checkverifies resume points, issue links and leftover draft markers;
changelog section headings are simplified - chartsdemo:
just chartsdemo,chartsdemo-html,chartsdemo-pageandchartsdemo-imagesshow or save a representative set of charts,
from examples/hbcexample.journal - checkanchors (
just anchortest): checks that #anchor links in the manual sources point to existing headings - CI: third-party actions and runner images updated; the addon functional tests run again (they had been accidentally excluded since 2017);
hledger-web's browser tests run on pull requests, as a non-blocking check; an experimental mac workflow uses the hx build tool - errors tests: converted to shelltest v3 format, with more examples
- functest: tests are isolated from the user's home directory; sorting uses LC_COLLATE=C, as in CI; more threads are used
- generaloptionshelp, installpage:
justrecipes automating the manuals' general options help and the Install page's version bumps - hledger-web: an on-demand Playwright browser test suite (
just browsertest); the favicon's sources and generator script; the systemd service file is updated (Patrick van de Glind) - i18n: i18n-extract.py collects translatable strings into hledger-lib/locale/hledger.pot, and checks catalogs for stale and untranslated entries;
just i18n-pot,i18n-check,i18n-merge,i18n-pseudo,i18n-web LANG(Arthur Cinader, Simon Michael) - Justfile: recipes recompile ./Shake when needed, avoiding stale scripts;
just holdings-*recipes try the holdings command against example data;
just devver(formerlydevtag-push);just hackagerevise;just site-update - release automation:
just ghrelassembles the github release on github, as a draft, andjust ghrel-publishmakes it public after review;
ANNOUNCE has sized versions for Mastodon and Bluesky/X - tools/regen-shelltests.py regenerates expected output in functional tests after a deliberate output change
credits 2.0
Simon Michael,
Arthur Cinader,
Henning Thielemann,
Dmitry Astapov,
Kevin F. Konrad,
Chunhui Ouyang,
Juan Wajnerman,
Martin,
Adam Sardo,
AidenTHu,
Andreas Pauley,
Caleb Maclennan,
Daniil Iaitskov,
Diego Depaoli,
GuillaumedeVolpiano,
JoeJoeflyn,
Joshua Chapman,
Juliano Solanho,
Patrick van de Glind,
Rostislav Raykov.
The amount expressions work was a bounty funded by James Shubin.
Install
The hledger Install page lists the easiest ways to install a recent release,
such as brew on macos, choco/scoop/winget on Windows, or eget on all platforms.
Or, follow these instructions to install the specific release binaries below:
GNU/Linux, 64-bit Intel
At the command line:
curl -fL https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-linux-x64.tar.gz | tar -xzv -f- -C/usr/local/bin hledger hledger-ui hledger-web
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
Prefix tar with sudo if /usr/local/bin is not writable.
Mac, 64-bit ARM or Intel
Open a terminal window.
(Don't download these binaries with your web browser - they won't get authorised.)
On ARM macs:
sudo mkdir -p /usr/local/bin
curl -fL https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-mac-arm64.tar.gz | sudo tar -xzv -f- -C/usr/local/bin hledger hledger-ui hledger-web
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
On Intel macs:
sudo mkdir -p /usr/local/bin
curl -fL https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-mac-x64.tar.gz | sudo tar -xzv -f- -C/usr/local/bin hledger hledger-ui hledger-web
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
If the version check shows an older version, you have another hledger earlier in $PATH; which -a hledger will find it.
Windows, 64-bit ARM or Intel
In a powershell window (press WINDOWS-R, powershell, ENTER).
(Don't download the zip with your web browser - programs downloaded that way may be blocked when you run them.)
cd ~
curl.exe -fLO https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-windows-x64.zip
Expand-Archive hledger-windows-x64.zip -Force -DestinationPath "$env:LOCALAPPDATA\Programs\hledger"
$env:LOCALAPPDATA\Programs\hledger (ie C:\Users\YOURNAME\AppData\Local\Programs\hledger) is not in $env:Path by default,
so if $env:Path doesn't show it, add it once:
[Environment]::SetEnvironmentVariable('Path', "$env:LOCALAPPDATA\Programs\hledger;" + [Environment]::GetEnvironmentVariable('Path','User'), 'User')
$env:Path = "$env:LOCALAPPDATA\Programs\hledger;$env:Path" # for this window; new windows will pick it up automatically
Then:
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
If the version check shows an older version, you have another hledger earlier in $env:Path; where.exe hledger will find it.
These are 64-bit Intel binaries; they also run on ARM machines (emulated).
They may also work on Windows 7:
use Windows Explorer to extract hledger-windows-x64.zip into a folder of your choice,
then open a command window (WINDOWS-R, cmd, ENTER) and run the hledger programs.
Next steps
Once installed, run hledger, and see the Docs.