alt3 / Docusaurus.Powershell

Docusaurus websites for PowerShell modules
https://docusaurus-powershell.vercel.app/
MIT License
30 stars 11 forks source link

Feature: Synopsis in MetaDescription #185

Open fflaten opened 4 months ago

fflaten commented 4 months ago

Consider making command help synopsis available as a variable in -MetaDescription like %2.

I know Maester currently post-processes this using: https://github.com/maester365/maester/blob/773ef48b864efe236fd497164198aea4589fc5e1/build/Update-CommandReference.ps1#L23-L31

bravo-kernel commented 4 months ago

I have three things on my list for this weekend. After that, I am open to accept a PR for this ;)

fflaten commented 4 months ago

Cool. No promises on PR, maybe in July. Considered it free-for-all 🙂

bravo-kernel commented 4 months ago

Cany you explain in concrete steps what you are suggesting? Description currently handled in this function?

fflaten commented 4 months ago

Basically just add (+ tests):

$synopsis = (Get-Help $powershellCommandName).Synopsis
# Ignore for commands with missing synopsis (they return `<linebreak><commandName> <linebreak>`)
if (($synopsis -replace '^\s+|\s+$') -ne $powershellCommandName) {
    $description = [regex]::replace($MetaDescription, '%2', $synopsis)`
}
bravo-kernel commented 4 months ago

I understand but the code is currently not "aware" of the commands or content during the md(x) processing as you can see here.

This would require reading in each command during the md-parsing process making me wonder if this does not better belong in userland/post-processing.

fflaten commented 3 months ago

Besides unit testing the module is always imported when Replacefrontmatter is called due to PlatyPS requirement (IIRC).

Regardless, it is always aware of the platyPS mdx, so we could extract synopsis from that if that's better.

If you think it belongs in userland that's fine. Just thought it might be a common use case worth covering OOB when there's already variable-support.

bravo-kernel commented 3 months ago

Ah, yes, I see now. Open to PR :)