Skip to content

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

Closed

Description

@weirdan

Describe the bug

I would expect | table --theme markdown to produce a markdown output I can use on e.g. Github. However when $env.config.table.header_on_separator is set to true, the output is invalid:

|-#-|---------------------description---------------------|---soft----|---hard----|
| 0 | Maximum size of files created by the shell (kB, -f) | unlimited | unlimited |

With $env.config.table.header_on_separator set to false, the output is fine:

# description soft hard
0 Maximum size of files created by the shell (kB, -f) unlimited unlimited

How to reproduce

  1. Run
    $env.config.table.header_on_separator = true
    ulimit | table --theme markdown
  2. Paste the output into any github field supporting markdown (issue body, comments, etc).
  3. Click Preview

The table looks messed up:

|-#-|---------------------description---------------------|---soft----|---hard----|
| 0 | Maximum size of files created by the shell (kB, -f) | unlimited | unlimited |

Expected behavior

Nushell produces an output that renders as a table on github:

# description soft hard
0 Maximum size of files created by the shell (kB, -f) unlimited unlimited
| # |                     description                     |   soft    |   hard    |
|---|-----------------------------------------------------|-----------|-----------|
| 0 | Maximum size of files created by the shell (kB, -f) | unlimited | unlimited |

Screenshots

No response

Configuration

key value
version 0.94.2
major 0
minor 94
patch 2
branch
commit_hash be8c1dc
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust_channel 1.77.2-x86_64-unknown-linux-gnu
cargo_version cargo 1.77.2 (e52e36006 2024-03-26)
build_time 2024-06-03 19:20:33 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, static-link-openssl, system-clipboard, trash, which
installed_plugins inc, query

Additional context

markdown, and probably restructured table themes should ignore $env.config.table.header_on_separator and produce a valid output regardless of the value it has.

Activity

  1. added
    status:needs-triage
    on Jun 15, 2024
  2. fdncred commented on Jun 15, 2024

    @fdncred
    Contributor

    I think this would take some hackery to fix because IIRC "markdown" is just an option on the tabled crate.

  3. weirdan commented on Jun 15, 2024

    @weirdan
    ContributorAuthor

    And header_on_separator?

  4. added
    category:bug
    A:table-renderer
    and removed
    status:needs-triage
    on Jul 11, 2024
  5. zhiburt commented on Jul 12, 2024

    @zhiburt
    Contributor

    Just bumped into the issue accidentally;

    Well I'd argue it's sort of expected, when you use header_on_separator.
    To be always compatible with github we shall turn off header_on_separator in case of markdown theme use.
    At least that's what I believe in.

    I mean these two aren't compatible in a sense of real markdown usage.

  6. weirdan commented on Jul 13, 2024

    @weirdan
    ContributorAuthor

    Well I'd argue it's sort of expected, when you use header_on_separator.

    Ideally it would be part of the theme, not its own setting.

  7. added this to the v0.116.0 milestone on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:table-renderercategory:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions