Closed bep closed 4 years ago
OK; I think this should make sense now. It still needs the Chroma PR and could probably do with a squash.
One question: Is this superfluous? I don't see it getting invoked:
I have updated the first comment with the changes made and squashed the commits.
So, this now works for me, but it should be improved to make it easier to use, ref.:
The above logic will break if you also enable line numbers with WithFormatOptions
.
Maybe depending on the outcome of https://github.com/alecthomas/chroma/issues/301 -- but I suggest you change WithFormatOptions
to take a custom struct that allows toggling of options.
I can make this change as part of this PR (this will then make the WithLineNumbers
and WithLineNumbersInTable
superfluous) if you want, or you/we could do it later.
I can make this change as part of this PR (this will then make the WithLineNumbers and WithLineNumbersInTable superfluous) if you want, or you/we could do it later.
Second thought, that would make a little bit too much duplication. I suggest we keep it as in this PR for now and you can consider changing it if the Chroma issue somehow gets accepted.
Seems that https://github.com/alecthomas/chroma/issues/301 is going to be accepted. I will fix that first, which should make this plenty simpler.
@yuin Chroma has tagged a new release, so this PR is ready to be considered for a merge. See the first comment for a list of changes.
@bep I take a quick look of this, it seems many unnecessary dependencies have been added to the go.sum
. Could you give a try to go mod tidy?
.
Could you give a try to go mod tidy?
Just did.
I originally did:
go get -u github.com/alecthomas/chroma
To get the new Chroma. I now see I need to rebase or something.
I have rebased and tidy'ed, but there are still many new go.sum entries. I don't know how to avoid that and get the updated Chroma.
@bep, OK. Changes almost no problem. I see 1 wrong comment. Could you fix it?