swsnr / mdcat

cat for markdown
https://crates.io/crates/mdcat
Mozilla Public License 2.0
2.13k stars 64 forks source link

broken table formatting #289

Closed dmig closed 1 month ago

dmig commented 1 month ago

steps to reproduce:

wget -O - https://raw.githubusercontent.com/swsnr/mdcat/main/README.md | mdcat

expected output - something like:

| Terminal                   |  Basic syntax | Syntax highlighting | Images | Jump marks |
| :------------------------- | :-----------: | :-----------------: | :----: | :--------: |
| Basic ANSI¹                | ✓             | ✓                   |        |            |
| Windows 10 console         | ✓             | ✓                   |        |            |
| [Terminology]              | ✓             | ✓                   | ✓      |            |
| [iTerm2]                   | ✓             | ✓                   | ✓³     | ✓          |
| [kitty]                    | ✓             | ✓                   | ✓³     |            |
| [WezTerm]                  | ✓             | ✓                   | ✓³     |            |

actual output:

| Terminal                   |  Basic syntax | Syntax highlighting | Images | Jump marks | | :------------------------- | :-----------: | :-----------------:
| :----: | :--------: | | Basic ANSI¹                | ✓             | ✓                   |        |            | | Windows 10 console         | ✓
| ✓                   |        |            | | Terminology              | ✓             | ✓                   | ✓      |            | | iTerm2
| ✓             | ✓                   | ✓³     | ✓          | | kitty                    | ✓             | ✓                   | ✓³     |            | | 
WezTerm                  | ✓             | ✓                   | ✓³     |            | | VSCode                   | ✓             | ✓                   | ✓³
|            |
dmig commented 1 month ago

mdcat 2.1.1 kitty 0.35.2

same issue

pengjiz commented 1 month ago

Per README, tables are not supported yet:

Not supported:

  • CommonMark extensions for footnotes and tables.

See also #2.

dmig commented 1 month ago

Ok, then it makes sense to pass-thru tables without reformatting them.

pengjiz commented 1 month ago

Dmitriy Geels @.***> writes:

Ok, then it makes sense to pass-thru tables without reformatting them.

Yeah that indeed sounds like a better way. Currently they are rendered and wrapped as text paragraphs.

I had a quick look and I think maybe we could turn on table parsing but render table rows as is, only to preserve the original formatting.

Sebastian, what do you think?

swsnr commented 1 month ago

To be honest I do not particularly care either way. Tables were never supported; it's been like this ever since this tool exists, and so far no one bothered enough to make a pull request :shrug:

I guess any change is an improvement, but someone needs to step up and do it, and it won't be me.

So do feel welcome to make a pull request to improve table support in any way. Meanwhile, though, I'll close this as not planned as I myself do not intend to work on it.