Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.79 KB

README.md

File metadata and controls

48 lines (36 loc) · 1.79 KB

Overview

There were quite a few solutions out there for converting PSObject to markdown table.

None of them did quite what I was looking for, so I borrowed the best parts from each.

Most of the credit goes to:

Usage

Install-Module Format-Markdown

Short Example

gci | select Name,FullName | fmd

Name      | FullName
--------- | -------------------------------------------------------------
src       | /Users/cpeterson/src/github/chris-peterson/pwsh-fmd/src
LICENSE   | /Users/cpeterson/src/github/chris-peterson/pwsh-fmd/LICENSE
README.md | /Users/cpeterson/src/github/chris-peterson/pwsh-fmd/README.md

Longhand Examples

Markdown Table

Get-ChildItem | Select-Object Name,FullName | Format-Markdown
Name      | FullName
--------- | -------------------------------------------------------------
src       | /Users/cpeterson/src/github/chris-peterson/pwsh-fmd/src
LICENSE   | /Users/cpeterson/src/github/chris-peterson/pwsh-fmd/LICENSE
README.md | /Users/cpeterson/src/github/chris-peterson/pwsh-fmd/README.md

JSON Table

Get-ChildItem | Select-Object Name,FullName | Format-Markdown -AsJsonTable
{"fields":[{"key":"Name","sortable":"true","label":"Name"},{"key":"FullName","sortable":"true","label":"FullName"}],"items":[{"Name":"README.md","FullName":"/Users/cpeterson/src/github/chris-peterson/pwsh-fmd/README.md"},{"Name":"README.md","FullName":"/Users/cpeterson/src/github/chris-peterson/pwsh-fmd/README.md"},{"Name":"README.md","FullName":"/Users/cpeterson/src/github/chris-peterson/pwsh-fmd/README.md"}],"filter":"true"}