KevinBatdorf / code-block-pro

A Gutenberg code block with syntax highlighting powered by VS Code
https://code-block-pro.com
126 stars 10 forks source link

Language request: Ledger (and ledger-likes) #163

Closed livtanong closed 1 year ago

livtanong commented 1 year ago

https://plaintextaccounting.org/

For reference, someone made a vscode ledger plugin, but he has since stopped supporting it. The syntax highlighting should still work though.

https://github.com/mariosangiorgio/vscode-ledger

KevinBatdorf commented 1 year ago

yeah I can ask upstream (shiki) if they will accept it. Do you have a decent code snippet that showcases it?

KevinBatdorf commented 1 year ago

On the link you shared they recommend some other VS Code extensions that have highlighting grammars. Do you think one of those would work? Probably not good to use something abandonded.

https://plaintextaccounting.org/#editor-plugins

Can you also point me to a good snippet I can use to demo it? Something official like from a documentation page.

And what's the file extension name? From what I can tell it's just bash scripts being used.

livtanong commented 1 year ago

Apologies for the late reply, it's been a busy few weeks.

  1. This should work, but I'm not sure how complete this is. The author said the amount is not highlighted (though if everything else around it is highlighted, then it is indirectly highlighted 😅 https://github.com/mhansen/hledger-vscode

This one seems more actively maintained and complete, but this is a "dialect" of ledger that has a slightly different feature set. It might be a superset in which case we don't have to worry much, but I'm not too familiar with beancount so I can't say for sure. https://github.com/Lencerf/vscode-beancount

  1. The documentation doesn't have a single comprehensive snippet as there are many alternate ways of writing things. Here's one though: https://ledger-cli.org/doc/ledger3.html#Commodities-and-Currencies-1
    
    2004/09/29  Circuit City
    Assets:Reimbursements:Company XYZ     $100.00
    Liabilities:MasterCard               $-100.00

2004/10/15 Company XYZ Assets:Checking $100.00 Assets:Reimbursements:Company XYZ $-100.00



The syntax is well-documented, and the basic syntax is fairly simple, but there is some extra stuff that can be confusing if you're not used to it.
https://ledger-cli.org/doc/ledger3.html#Basic-format

3. There is no formal extension name but the de facto is `.journal` and `.ledger` and `.hledger`. I'm not familiar enough with beancount to tell you what its extension name is.
KevinBatdorf commented 1 year ago

I sent a PR for beancount since that seems more active and complete. I'll follow up when it's released.

simonmichael commented 1 year ago

Thanks for the issue and PR.

Any hledger support is also welcome, here is the current https://hledger.org/dev/hledger.html#journal-cheatsheet

https://plaintextaccounting.org/quickref is an older summary of the big three PTA apps' journal syntax.