Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Synopsis in MetaDescription #185

Open
fflaten opened this issue Jun 20, 2024 · 7 comments
Open

Feature: Synopsis in MetaDescription #185

fflaten opened this issue Jun 20, 2024 · 7 comments

Comments

@fflaten
Copy link
Contributor

fflaten commented Jun 20, 2024

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

@fflaten fflaten changed the title Feature: Syntax in MetaDescription Feature: Synopsis in MetaDescription Jun 20, 2024
@bravo-kernel
Copy link
Contributor

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

@fflaten
Copy link
Contributor Author

fflaten commented Jun 20, 2024

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

@bravo-kernel
Copy link
Contributor

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

@fflaten
Copy link
Contributor Author

fflaten commented Jun 21, 2024

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
Copy link
Contributor

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
Copy link
Contributor Author

fflaten commented Jul 13, 2024

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants