Open
Description
Describe the bug
When piping a table that contains empty values into the to md
command, the resulting markdown table is replaced and/or interspersed with the string "[table X row]".
When the --per-element
flag is passed, the non-empty rows are treated as one table and the empty rows are treated as another. There is no newline between the two tables in the resulting output string.
How to reproduce
❯ : [ {name: bob, age: 21} {name: jim, age: 20} {name: sarah}]
╭───┬───────┬─────╮
│ # │ name │ age │
├───┼───────┼─────┤
│ 0 │ bob │ 21 │
│ 1 │ jim │ 20 │
│ 2 │ sarah │ ❎ │
╰───┴───────┴─────╯
❯ : [ {name: bob, age: 21} {name: jim, age: 20} {name: sarah}] | to md
|name|
|-|
|[table 2 rows]|
|sarah|
❯ : [ {name: bob, age: 21} {name: jim, age: 20} {name: sarah} {name: timothy, age: 50} {name: paul} ]
╭───┬─────────┬─────╮
│ # │ name │ age │
├───┼─────────┼─────┤
│ 0 │ bob │ 21 │
│ 1 │ jim │ 20 │
│ 2 │ sarah │ ❎ │
│ 3 │ timothy │ 50 │
│ 4 │ paul │ ❎ │
╰───┴─────────┴─────╯
❯ : [ {name: bob, age: 21} {name: jim, age: 20} {name: sarah} {name: timothy, age: 50} {name: paul} ] | to md
[table 3 rows]
[table 2 rows]
❯ : [ {name: bob, age: 21} {name: jim, age: 20} {name: sarah} {name: timothy, age: 50} {name: paul} ] | to md --per-element
|name|age|
|-|-|
|bob|21|
|jim|20|
|timothy|50||name|
|-|
|sarah|
|paul|
Expected behavior
I would expect the empty items to be replaced with whitespace, the string "NULL" or "N/A", or have some other method of preserving the original table.
Configuration
key | value |
---|---|
version | 0.100.0 |
major | 0 |
minor | 100 |
patch | 0 |
branch | |
commit_hash | |
build_os | macos-aarch64 |
build_target | aarch64-apple-darwin |
rust_version | rustc 1.82.0 (f6e511eec 2024-10-15) (Homebrew) |
cargo_version | cargo 1.82.0 |
build_time | 2024-11-13 20:37:01 -06:00 |
build_rust_channel | release |
allocator | mimalloc |
features | default, sqlite, trash |
installed_plugins | formats 0.99.1, gstat 0.99.1, highlight 1.4.1+0.100.0, inc 0.99.1, polars 0.99.1, query 0.99.1 |