Messing with WordClouds using PowerShell
An example of creating and rendering word clouds in .NET Interative leveraging PowerShell and Markdown.
Install PSWordCloud by @vexx32
Install-Module PSWordCloud -Force
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)
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!