Install PSWordCloud by @vexx32

Install-Module PSWordCloud -Force

Create a word cloud

First, let's grab the .NET Interactive codebase. That'll be what we make a word cloud out of.

Get the zip, extract it and delete it:

irm https://api.github.com/repos/dotnet/interactive/zipball -OutFile interactive.zip
try {
    Expand-Archive ./interactive.zip -Force
} finally {
    Remove-Item ./interactive.zip
}

Get all of the files from the interactive folder, read their contents and craft a word cloud with it.

Get-ChildItem -Recurse -File ./interactive/ | Get-Content | New-WordCloud -Path ./dotnet-interactive.svg

Leveraging the #!markdown magic command, we can render our new SVG:

Note: My blog mangles this path for some reason... the actual ’path’ should just be dotnet-interactive.svg

#!markdown

![.NET Interactive codebase word cloud](dotnet-interactive.svg)

Create an in-memory word clouds

As of PSWordCloud v3, you can output results directly into a variable using the variable provider:

Get-ChildItem -Recurse -File ./interactive/ | Get-Content | New-WordCloud -Path variable:mySVG

Then you can use that variable and pipe it directly into Out-Display to render the SVG! No file needed 😁

$mySVG | Out-Display

That's how you can easily use word clouds in .NET Interactive!