Open elric1 opened 4 months ago
We used to have table rendering, but it was removed in 586c0c2edb01893b56316ab4de0356c694a179dd.
Maybe we can bring it back behind a config option (e.g.: make it optional). I think the Formatter
plumbing might work for this.
Oh, I didn't see that. It does end up being a little different than what I was doing, in a number of ways:
Is using tabulate important for this patch, or is it acceptable to just format it ourselves? Tabulate appears to provide quite a few extra types of output which could be quite nice to offer such as HTML or LaTeX, so maybe the best strategy would be to extend tabulate and submit a PR with them and use it?
In accordance with your comments above, I have changed approach. Now, I submit a patch to use tabulate, but I make it configurable so that the TableFormat can be selected by the user. They can therefore use plain, html, markdown, etc. I also submitted a pull request to the tabulate project to add a "flow" table type which does not align the columns and drops empty columns: Tabulate PR#314
Tests indicate that there are extra spaces in the default outputs: https://builds.sr.ht/~whynothugo/job/1161850#task-test-517
You can run tests locally with tox -e py
.
Feel free to ask if you have issues running tests.
This approach is good, using tabulate
is a lot less code and I know it works well already :+1: