Skip to content

fix(table): keep markdown and restructured headers off the separator - #19066

Merged
fdncred merged 1 commit into
nushell:mainfrom
mrhard9090:fix/table-markup-header-on-separator
Sep 23, 2026
Merged

fdncred merged 1 commit into
nushell:mainfrom
mrhard9090:fix/table-markup-header-on-separator

Conversation

@mrhard9090

Copy link
Copy Markdown
Contributor

With $env.config.table.header_on_separator = true, the markdown and restructured themes drew the header inside the top border, which produces invalid markup:

|-#-|-a-|-b-|
| 0 | 1 | 2 |
=#= =a= =b=
 0   1   2
=== === ===

These two themes exist to emit markup that other tools parse, so as suggested in #13161, configure_table now ignores header_on_separator for them. Every table goes through configure_table (general and --expand), so this covers both. Other themes are unchanged.

After:

| # | a | b |
|---|---|---|
| 0 | 1 | 2 |

wrap_and_truncate_differ_for_every_theme_with_header_on_separator (from #18979) no longer lists markdown and restructured. With the header in its own row, wrapping and truncating give identical output for this data on every theme (e.g. rounded with header_on_separator = false), because overflowing columns are replaced with .... The two only differ in the header-on-border layout, which these themes no longer use.

User-facing changes (Release notes)

table --theme markdown and table --theme restructured (and the matching $env.config.table.mode values) now always produce valid Markdown / reStructuredText, even when $env.config.table.header_on_separator is enabled.

Tests + Formatting

  • Added table_markup_themes_ignore_header_on_separator. It fails without this change (|-#-|-a-|-b-|) and passes with it.
  • cargo test -p nu-command --test tests -- commands::table::: 492 passed
  • cargo fmt --all -- --check
  • cargo clippy -p nu-table -p nu-command --all-targets -- -D warnings -D clippy::unwrap_used

Additional notes

Fixes #13161

With `$env.config.table.header_on_separator = true`, the markdown and
restructured themes drew the header inside the top border, producing
invalid markup (`|-#-|-a-|` instead of a header row plus `|---|`).

These themes exist to emit valid markup, so ignore `header_on_separator`
for them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fdncred
fdncred merged commit 356e1c8 into nushell:main Sep 23, 2026
15 checks passed
@fdncred

fdncred commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Thanks

@github-actions github-actions Bot added this to the v0.116.0 milestone Sep 23, 2026
@fdncred fdncred added notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

table --theme markdown produces invalid markdown when $env.config.table.header_on_separator is set to true

2 participants