Fix to md --pretty when rendering a list (#5932)

Fixes #5931

Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
nibon7 2022-07-02 20:36:16 +08:00 committed by GitHub
parent 3917fda7ed
commit be7f35246e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,11 @@ impl Command for ToMd {
"# Welcome to Nushell\n| foo | bar |\n| --- | --- |\n| 1 | 2 |",
)),
},
Example {
description: "Render a list",
example: "[0 1 2] | to md --pretty",
result: Some(Value::test_string("0\n1\n2")),
},
]
}
@ -291,7 +296,7 @@ fn get_output_string(
}
for i in 0..row.len() {
if pretty {
if pretty && column_widths.get(i).is_some() {
output_string.push(' ');
output_string.push_str(&get_padded_string(row[i].clone(), column_widths[i], ' '));
output_string.push(' ');