Skip to content

Rendered Markdown table ignores justify #8609

@AdrienHorgnies

Description

@AdrienHorgnies

Describe the feature or problem you’d like to solve

Mardown allows justifying a column to the left, center or right.
When view a Markdown file on the command line, the columns are always justified to the left.
Instead, it should abide by the justification set in the header of the table.

See the below table:

Period Day Part Duration
2024-01-21 Evening 6m
2024-01-21 Night 1h55m
2024-01-22 Noon 44m
2024-01-22 Afternoon 2h00m

Assuming you're viewing this issue from a modern Browser,
you should see that the third column is right justified, thanks to the notation ---:.

But when rendered by gh, using for example gh gist view ID where ID references a gist containing a markdown file, we get:

      PERIOD   │ DAY PART  │ DURATION
  ─────────────┼───────────┼───────────
    2024-01-21 │ Evening   │ 6m
    2024-01-21 │ Night     │ 1h55m
    2024-01-22 │ Noon      │ 44m
    2024-01-22 │ Afternoon │ 2h00m

Proposed solution

  • left justified: same as now
  • right justified: pad value from the left using spaces to match width of longest value (see example below)
  • center justified: pad left and right to match width of longest value (if odd number of padding spaces, prefer left padding)
      PERIOD   │ DAY PART  │ DURATION
  ─────────────┼───────────┼───────────
    2024-01-21 │ Evening   │       6m
    2024-01-21 │ Night     │    1h55m
    2024-01-22 │ Noon      │      44m
    2024-01-22 │ Afternoon │    2h00m

Additional context

Add any other context like screenshots or mockups are helpful, if applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions