-
Notifications
You must be signed in to change notification settings - Fork 289
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
Indentation on Comment-Based help #147
Comments
This isn't a prescription, but I generally do one of these two ways: function New-PSCredential {
<#
.Synopsis
Creates a new PSCredential with the specified properties
#> Or function Export-Theme {
<#
.SYNOPSIS
Exports a theme to a file
#> I'm still debating whether:
I will admit that my main reason for indenting is to control code folding in VS Code. VS Code bases the folding of those lines on the indentation. If I don't indent the |
Re: ALL CAPS, that's what I do. This is what mine typically look like: function Invoke-Something {
<#
.SYNOPSIS
My synopsis.
#> I keep the That's interesting you mention about being able to fold a section of help. I'm trying that now in VS Code and I don't see the option to fold a section of help... |
Yeah, that's due to changes from the PowerShell extension. I've asked for this to be fixed, it's because the syntax-based code-folding doesn't care about the help comments... |
FYI: not so known but also to consider, the fact that it is valid to use single comment lines for your help: function Read-HtmlTable {
# .SYNOPSIS
# Reads a HTML table
# .DESCRIPTION
# Scrapes (extracts) a HTML table from a string or the internet location
# .INPUTS
# String or Uri
# .OUTPUTS
# PSCustomObject[]
# .PARAMETER InputObject
# The html content (string) that contains a html table.
# If the string is less than 2048 characters and contains a valid uri protocol, the content is downloaded
# from the concerned location.
} |
This is really well known, among those who've been around since version 1 😉 it used to be the only way to do it, and there was a little debate about adding block comments. We particularly recommend block comments for documentation (it makes it easier to edit, and it improves code-folding of the documentation in most editors). |
What's the stance on the indentation on comment-based help?
Personally, I left-align the comment-based help so I can get the most line length out of it, and I also try to keep comment-based help under 114 characters long else I see weird line wrapping issues with
Get-Help
. (I know using PlatyPS would avoid some of these issues, but one doesn't always go to those lengths for every script, probably only for modules.)The text was updated successfully, but these errors were encountered: