Giter VIP home page Giter VIP logo

psmarkdown's Introduction

PSMarkdown

A Powershell Module that lets you convert from a PowerShell object to a Markdown table and back.

Table of Contents

Install

There are two ways to install this module. If you are running PowerShell v5

Install-Module PSMarkdown

Otherwise, to install in your personal modules folder (e.g. ~\Documents\WindowsPowerShell\Modules), run:

iex (new-object System.Net.WebClient).DownloadString('https://raw.github.com/ishu3101/PSMarkdown/master/Install.ps1')

Getting Started

To start using, just import the module using

Import-Module PSMarkdown

After installation, the following commands are available: ConvertTo-Markdown, ConvertFrom-Markdown

Get Help

  • List of all available commands

    Get-Command -Module PSMarkdown
  • Help for a specific command.

    Get-Help <command>

Commands

For more detailed information about a command use the help

ConvertTo-Markdown

Converts a PowerShell object to a Markdown table.

Usage

ConvertTo-Markdown [-InputObject] <PSObject[]> [<CommonParameters>]

Example

Get-Process | Where-Object {$_.mainWindowTitle} | Select-Object ID, Name, Path, Company | ConvertTo-Markdown
ConvertTo-Markdown (Get-Date)
Get-Alias | Select-Object Name, DisplayName | ConvertTo-Markdown

ConvertFrom-Markdown

Converts a Markdown table to a PowerShell object.

Usage

ConvertFrom-Markdown [-InputObject] <Object> [<CommonParameters>]

Example

Get-Service | Select-Object Name, DisplayName, Status | ConvertTo-Markdown | ConvertFrom-Markdown
Get-Process | Unique | Select-Object Name, Path, Company | ConvertTo-Markdown | ConvertFrom-Markdown
ConvertTo-Markdown (Get-Service | Where-Object {$_.Status -eq "Running"} | Select-Object Name, DisplayName, Status) | ConvertFrom-Markdown

Credit

Thanks Ben Neise for the initial code for ConvertTo-Markdown function

License

PSMarkdown is released under the MIT license. See LICENSE for details.

psmarkdown's People

Contributors

ishu3101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

psmarkdown's Issues

ConvertTo-Markdown rearranges the columns

Get-Process` | Select-Object ProcessName,Id,CPU |ConvertTo-Markdown

outputs

ProcessName                     | CPU          | Id   
------------------------------- | ------------ | -----

Notice that the sequence of

  1. ProcessName
  2. Id
  3. CPU

has been changed to

  1. ProcessName
  2. CPU
  3. Id

I experimented a bit with different sequences but I couldn't find the pattern.

Extending the module with more functionality

I've sent you also an email from the powershellgalery.com communication channel.

I want to make a full Markdown rendering module. The ability to render a table is what pointed me to this repository in the first place.

I see two options:

  • I become a contributor to your project. But I have some different ideas on the module structure.
  • I create a new module that depends on yours for the table rendering.
  • I create a new module that embeds your good proven functionality.

As part of this, I want to do Pester testing etc so the repository would change a lot.

You can check my ongoing effort in my fork at https://github.com/Sarafian/PSMarkdown.
A couple of things

  • I'm driving the features from Markdown syntax guide
  • I used your format in spliting the .psm1 and .ps1 but I added a test script for Pester
  • No comments yet

I'm wondering what is your preference?
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.