Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

to md for formats

Convert table into simple Markdown.

Signature

> to md {flags}

Flags

  • --pretty, -p: Formats the Markdown table to vertically align items
  • --per-element, -e: treat each row as markdown syntax element
  • --center, -c {list<cell-path>}: Formats the Markdown table to center given columns

Input/output types:

inputoutput
anystring

Examples

Outputs an MD string representing the contents of this table

> [[foo bar]; [1 2]] | to md
|foo|bar|
|-|-|
|1|2|

Optionally, output a formatted markdown string

> [[foo bar]; [1 2]] | to md --pretty
| foo | bar |
| --- | --- |
| 1   | 2   |

Treat each row as a markdown element

> [{"H1": "Welcome to Nushell" } [[foo bar]; [1 2]]] | to md --per-element --pretty
# Welcome to Nushell
| foo | bar |
| --- | --- |
| 1   | 2   |

Render a list

> [0 1 2] | to md --pretty
0
1
2

Separate list into markdown tables

> [ {foo: 1, bar: 2} {foo: 3, bar: 4} {foo: 5}] | to md --per-element
|foo|bar|
|-|-|
|1|2|
|3|4|
|foo|
|-|
|5|

Center a column of a markdown table

> [ {foo: 1, bar: 2} {foo: 3, bar: 4}] | to md --pretty --center [bar]
| foo | bar |
| --- |:---:|
| 1   |  2  |
| 3   |  4  |