Byron/pulldown-cmark-to-cmark

Option to render human-friendly tables

Offen

#105 geöffnet am 07.04.2025

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (46 Forks)auto 404
help wanted

Repository-Metriken

Stars
 (60 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 35m) (1 gemergte PR in 30 T)

Beschreibung

When rendering a markdown table, this crate strips all the padding whitespace in table cells and sets the header rule to the same width as the respective header:

|Here is a header|Another header|
|:---------------|:-------------|
|foo|bar|
|quux|baz|
|something really long||

This is valid markdown for representing the table, but it's not very human-friendly. It would be nice if there were an option to have cell whitespace padding and for each column to have a uniform width (i.e., the maximum width of the cells in that column + padding). So we'd get output like this:

| Here is a header      | Another header |
| :-------------------- | :------------- |
| foo                   | bar            |
| quux                  | baz            |
| something really long |                |

These tables are equivalent, but the latter is much easier to read.

Contributor Guide