ishu3101 / PSMarkdown

Powershell Module to convert from a PowerShell object to a Markdown table and back
MIT License
23 stars 8 forks source link

ConvertTo-Markdown rearranges the columns #2

Open Sarafian opened 8 years ago

Sarafian commented 8 years ago
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.

gregharms commented 7 years ago

Commenting to say I experienced the same issue where the order of property names in Select-Object is not reflected in ConvertTo-Markdown output.

Sarafian commented 7 years ago

This is an issue in general with powershell. When using plain hashes, you cannot be sure about the sequence of the keys. Try [ordered] and you might get improvements. I had to work with these concepts when I developed my own powershell markdown renderer Sarafian/MarkdownPS

herculosh commented 6 years ago

@ishu3101 see my pull request #3 - it would be nice to implement. Thanks a lot.