.md as an output option

Hello all,

I’ve been using hledger for a a few years now saving is results as .csv files for additional back up.

However what are the chances of hledger developing a .md output function such that income statements, balance sheets etc are provided in markdown format for future publishing or inclusion in other documents.

My main use is hledger but my main programming knowledge is c++ (mostly hardware at that), so it’s not something I could develop myself for a while (having to learn Haskell first).

Posting here instead of an issue request to see if I’m the only one who would find this useful.

Thanks all, and thanks Simon for a great piece of software.

2 Likes

I agree that would be nice. As an alternative, you can output html and convert that to markdown with pandoc (IIRC) ?

1 Like

Good point re: html, will try that.

I am careful with what I say here, but it does look like that the --tree and the --pretty output are really close already to a nicely formatted markdown table, so it appears that this would be an easy implementation. But again, careful with what I say, as I haven't seen the source code.

Ah, here I see I just inserted HTML output into markdown files - it is part of markdown after all. (Not what you're wanting, I know.)

For producing something document-like, I had great success with writing in org-mode with org-babel sections that run hledger commands and capture the output. The whole file could then be exported into tex or html from org-mode

Thanks that works nicely for the most part, however I tried the multicolumn output and it certainly broke iA writers ability to render it. In obsidian it worked o.k ish.

However iA writer can render a csv into a nice table so -o csv works well for iA writer (which I use mainly anyway) .

Appreciate the replies

Nice, glad that works. But like Haskell, no experience with org-mode either I am afraid.

I am not a fan of preformatted reports like HTML or MD or PDF.

Hledger has a very good json output and a somewhat usable CSV.

Depending on what exactly the report shall be used for, one can pipe these outputs through specialized tooling to actually render a report that is exactly as they need it. Be it corporate identity or be it legal requirements or both.

I get that with json you can format it your way, but why not an extra convenience?

Thanks, that’s what I was trying to say. Yes I have csv output and it’s good, great even. But an -o md flag would make life a but more convenient in being able to store an income statement in .md ready for presentation and future storage.

About a few months ago, I was obsessed with generating a nice printable report with I.S. and B.S.

After many iterations, I managed to hack a Go program that runs hledger with JSON output and pipes it to a predefined Typst template. hlgo was actually a byproduct of this effort.

Result:


*Example data generated with LLM, pdf rendered with imagemagick

My initial plan was to open-source this, but it's very rough around the edges and got way too complicated for what it does (should've written it in Python), so that's not going to happen, at least for now.

edit: added daily report image

1 Like

This is very nice indeed. Well done.