Optimize table formatting for text readability #434
Replies: 4 comments
-
Nice, I like this idea a bunch! Do you have any interest in contributing the change itself? Let me know. |
Beta Was this translation helpful? Give feedback.
-
Thanks for being receptive to the idea. I have lots of interest but limited time. I don't know when next I would have a chance to do it, unless you believe it would be a fairly trivial change. |
Beta Was this translation helpful? Give feedback.
-
I wanna say "reasonably trivial", but I haven't gone into the details yet; you'll need to look ahead when formatting to find out the maximum length of each column. The changes will all happen here: Lines 555 to 601 in bc35d22 I'll leave it with you for now, and if you don't happen to find the time, that's no problem. I'll leave a comment if I do start on it myself. |
Beta Was this translation helpful? Give feedback.
-
See #139 for a proposed PR that would affect where the option for this lives. |
Beta Was this translation helpful? Give feedback.
-
When I have the urge to format a Markdown table, I generally have one of two outcomes in mind:
Currently, comrak defaults to optimizing for storage. That is, a table input with extra spaces or dashes loses in output any unnecessary spaces or dashes in cells.
I'd like to see an option to optimize for readability. That is, a table input will have its cells padded with spaces or dashes to fit the longest cell in that column.
Example input:
Comrack 0.6.2 output, optimized for storage:
Output optimized for text readability by markdowntable.com (src):
This latter format is better for static files like READMEs that are just as often read in text format as they are consumed in HTML format and other places where editing the table is more important than reducing the byte size of the table.
Beta Was this translation helpful? Give feedback.
All reactions