Evotec Services sp. z o.o., ul. Drozdów 6, Mikołów, 43-190, Poland

PSParseHTML – Parse HTML PowerShell Module

PSParseHTML

PSParseHTML is PowerShell module that's main purpose is to be a helper module for PSWriteHTML. However it's functionality can be utilized in other projects, not related to PSWriteHTML, therefore it's available as a separate module. Basic how-to usage is described on this blog post.

PSParseHTML has 10 functions:

  • Convert-HTMLToText
  • ConvertFrom-HtmlTable
  • ConvertFrom-HTMLAttributes (aliases: ConvertFrom-HTMLTag, ConvertFrom-HTMLClass)
  • ConvertFrom-HTML
  • Format-CSS
  • Format-HTML
  • Format-JavaScript
  • Optimize-CSS
  • Optimize-HTML
  • Optimize-JavaScript

The expected input is a string or from a file. The expected output to string or to file. While it doesn't seem much those 10 functions are very powerful and can achieve a lot when it comes to parsing HTML.

Installation

Install from PSGallery

Install-Module -Name PSParseHTML -AllowClobber -Force

Force and AllowClobber aren't necessary but they do skip errors in case some appear.

Update from PSGallery

Update-Module -Name PSParseHTML

That's it. Whenever there's a new version you simply run the command and you can enjoy it. Remember, that you may need to close, reopen PowerShell session if you have already used module before updating it.

The important thing is if something works for you on production, keep using it till you test the new version on a test computer. I do changes that may not be big, but big enough that auto-update will break your code. For example, small rename to a parameter and your code stops working! Be responsible!

3rd party references

This module uses several external libraries to do its work. The authors of those libraries made a fantastic job. I've just added some PowerShell to the mix.