-
Notifications
You must be signed in to change notification settings - Fork 157
Add "powershell" label to examples markdown #294
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
Comments
Thank you for the suggestion. I had a conversation about it with @juanpablojofre and other tech writers. I see that this topic created a lot of confusion, so let me write down my thinking and maybe open a discussion about it. This "powershell" language moniker is called info-string in the commonmark spec. It says:
My interpretation of it is that code inside the code block should be a syntactically valid program in this language. Practically, you should be able to copy-paste this program. The traditionally used To workaround this problem, I implemented support for multiply code blocks inside one example.
To summarize
Since this topic been a big source of confusion for a long time, I see a need of making guidelines about examples code snippets clearer. There are few competing goals:
More I think about it, more I agree that we should sacrifice number 3 and use the following format: PS C:\> New-AwesomeCommand -With -All -Arguments
This way
|
Currently if the ```powershell syntax is used it will be removed by Update-MarkdownHelp. |
@BernieWhite good catch |
Following on, for SYNTAX sections there should be no reason why the ```powershell fenced should not be the default. |
I cannot agree with that
The SYNTAX is not a valid program in powershell and hence it would not benefit from the syntax highlighting. It's possible to find some other highlighting moniker that can produce a reasonable results, but I don't see any reason why it would be To illustrate it, let's take a look at example Plain text
Powershell Merge-MarkdownHelp [-Path] <String[]> [-OutputPath] <String> [-Encoding <Encoding>] [-ExplicitApplicableIfAll]
[-Force] [[-MergeMarker] <String>] [<CommonParameters>] Bash Merge-MarkdownHelp [-Path] <String[]> [-OutputPath] <String> [-Encoding <Encoding>] [-ExplicitApplicableIfAll]
[-Force] [[-MergeMarker] <String>] [<CommonParameters>] Haskell Merge-MarkdownHelp [-Path] <String[]> [-OutputPath] <String> [-Encoding <Encoding>] [-ExplicitApplicableIfAll]
[-Force] [[-MergeMarker] <String>] [<CommonParameters>] Scala Merge-MarkdownHelp [-Path] <String[]> [-OutputPath] <String> [-Encoding <Encoding>] [-ExplicitApplicableIfAll]
[-Force] [[-MergeMarker] <String>] [<CommonParameters>] js Merge-MarkdownHelp [-Path] <String[]> [-OutputPath] <String> [-Encoding <Encoding>] [-ExplicitApplicableIfAll]
[-Force] [[-MergeMarker] <String>] [<CommonParameters>] It looks like JS is actually looks better on average, should we then use it? |
@vors Thanks. I see your point. |
Further thought on this one, does the prefix |
Hmm, good point. |
I'll have a look at this one. I noticed, if we currently have two separate code blocks defined under the one example like below, they will merge together into a single block during PS C:\> New-AwesomeCommand -With -All -Arguments
i.e.
Based on the discussion above we will need to keep the blocks separated in markdown. Thoughts on Yaml. Is it ok to aggregate the multiple code blocks like the existing markdown implementation when generating yaml output? platyPS/src/Markdown.MAML/Transformer/ModelTransformerBase.cs Lines 181 to 191 in ffd067e
|
Oh good catch! |
@vors Thoughts on info-string for output blocks? Schema says don't use an info-string for output blocks. From a implementation point of view it makes sense to only detect language based on blocks that do not already have an info-string. Meaning output blocks might incur a slightly higher cost for each My preference would be to use an info-string of This aligns to PS docs style guide as per MicrosoftDocs/PowerShell-Docs#1511. |
The query into how prompts are handled from documentation (particularly relating to cross-platform scenarios) resulted in a link to this document (brand new guidance). https://github.com/PowerShell/PowerShell-Docs/blob/staging/contributing/FORMATTING-CODE.md From the document both We should include at least We should also allow for customising the default info-string for non-PS detected blocks. So default to no info-string, then if a block hasn't been detected as PS use the custom info-string if set. |
Our current style says that Examples should use the |
Note that this has implications for anyone using a Markdown linter like The reasoning for stripping the language specifier from the |
This is fixed in Microsoft.PowerShell.PlatyPS v1 for examples. We don't add a language to the syntax blocks because they are not |
Upon moving to docs.microsoft.com, we've been asked to add "powershell" to the opening code block of each example. Is it possible to do this so all new cmdlets have it by default?
Here's an example before:
EXAMPLES
Example 1: Add AIA to the specified authority
And here's an example after:
EXAMPLES
Example 1: Add AIA to the specified authority
The text was updated successfully, but these errors were encountered: