Adding ASCII and Markdown output rendering #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! This is my first ever pull request, so please let me know if I've missed some crucial etiquette. I needed regression tables for my Python/markdown-based dissertation build system, and adding it to stargazer seemed like the shortest path. Maybe someone else will benefit too! Here's a rundown of the proposed changes:
I implemented an abstract set of
generate_cells
methods, following the code paths from thegenerate_html
methods. These return a two-dimensional array of strings, which could be used for other render formats as well. (It might be valuable to refactor the html output to use this where possible.) The 2d grid of cells intentionally limits some of the functionality--no rowspans or colspans are supported.I also added a few new properties which will be valuable for anyone trying to export markdown regression tables:
The separators could be changed to
\n
, which is particularly nice because tabulate converts newlines into whatever markdown format is requested. Thesig_char
may need to be replaced by an escaped version of itself in some output contexts.Once the
generate_cells
methods were implemented, I usetabulate
(new dependency) to render these cells to ascii or any supported flavor of markdown.