Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars1015
Forks112
Open issues54
PowerShell Gallery downloads7576901
Releasev1.41.0
Language: PowerShell Updated: 2026-08-10T20:00:10.0000000+00:00

Curated Examples

Example Generatehelp

Source-owned example maintained with PSWriteHTML.

Import-Module .\PSWriteHTML.psd1 -Force

function New-HTMLTreeFileNodes {
    [CmdletBinding()]
    param(
        [string] $Path,
        [switch] $IsExpanded,
        [string[]] $Filter,
        [switch] $RelativePath,
        [string] $Root
    )
    $FileSystem = Get-ChildItem -Filter * -Path $Path | Select-Object -First 10
    foreach ($F in $FileSystem) {
        if ($F.PSIsContainer) {
            New-HTMLTreeNode -Title $F.BaseName -Folder {
                New-HTMLTreeFileNodes -Path $F.FullName -IsExpanded:$IsExpanded.IsPresent -Filter $Filter -RelativePath:$RelativePath.IsPresent -Root $Path
            } -IsExpanded:$IsExpanded.IsPresent
        } else {
            if ($Filter) {
                $Found = $false
                foreach ($Find in $Filter) {
                    if ($F.Name -like $Find) {
                        $Found = $true
                        break
                    }
                }
                if (-not $Found) {
                    continue
                }
            }
            if ($RelativePath) {
                $Link = $F.FullName.Replace("$Root\\", '')
            } else {
                $Link = $F.FullName
            }
            New-HTMLTreeNode -Title $F.Name -HrefLink $Link -Target 'contentFrame'
        }
    }
}


New-HTML -TitleText 'This is a test' -FilePath "$PSScriptRoot\..\ShowMe.html" {

    New-HTMLSection -Invisible {
        New-HTMLSection {
            New-HTMLTree -Checkbox none {
                New-HTMLTreeChildCounter -Deep -HideZero -HideExpanded
                New-HTMLTreeFileNodes -Path 'C:\Support\GitHub\PSWriteHTML\Examples' -Filter *.html -IsExpanded
            } -EnableChildCounter -AutoScroll
            New-HTMLSection -Invisible {
                New-HTMLFrame -Name 'contentFrame' -Scrolling Auto -Height 550px
            }
        }
    }
} -Online -ShowHTML