Open fflaten opened 4 months ago
I have three things on my list for this weekend. After that, I am open to accept a PR for this ;)
Cool. No promises on PR, maybe in July. Considered it free-for-all 🙂
Cany you explain in concrete steps what you are suggesting? Description currently handled in this function?
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)`
}
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.
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.
Ah, yes, I see now. Open to PR :)
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