Skip to content

Commit 7234f18

Browse files
authored
Merge pull request #796 from sdwheeler/sdw-w476169-main-docs
Update repo docs in main branch
2 parents fc58b48 + 96a51b1 commit 7234f18

26 files changed

+304
-2659
lines changed

CHANGELOG.md

Lines changed: 81 additions & 209 deletions
Large diffs are not rendered by default.

CODE_OF_CONDUCT.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct][02].
4+
5+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and
6+
healthy community.
7+
8+
## Our Standards
9+
10+
Examples of behavior that contributes to a positive environment for our community include:
11+
12+
- Demonstrating empathy and kindness toward other people
13+
- Being respectful of differing opinions, viewpoints, and experiences
14+
- Giving and gracefully accepting constructive feedback
15+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the
16+
experience
17+
- Focusing on what's best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
- Disruptive behavior
22+
- Submitting spam comments, issues, or pull requests
23+
- Defacing or vandalizing the project, repository, content, or documentation
24+
- Intentionally introducing security vulnerabilities
25+
- Disrespectful behavior
26+
- Trolling, insulting or derogatory comments, and personal or political attacks
27+
- Public or private harassment
28+
- Publishing others' private information, such as a physical or email address, without their
29+
explicit permission
30+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
31+
- Other conduct that could reasonably be considered inappropriate in a professional setting
32+
33+
## Resources
34+
35+
- [Microsoft Open Source Code of Conduct][02]
36+
- [Microsoft Code of Conduct FAQ][03]
37+
- Contact [opencode@microsoft.com][04] with questions or concerns
38+
- Employees can reach out at [aka.ms/opensource/moderation-support][01]
39+
40+
<!-- link references -->
41+
[01]: https://aka.ms/opensource/moderation-support
42+
[02]: https://opensource.microsoft.com/codeofconduct/
43+
[03]: https://opensource.microsoft.com/codeofconduct/faq/
44+
[04]: mailto:opencode@microsoft.com

CONTRIBUTING.md

Lines changed: 45 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,45 @@
1-
# Contributing to platyPS
2-
3-
## Get the code
4-
5-
```
6-
git clone https://github.com/PowerShell/platyPS
7-
```
8-
9-
## Understand code layout
10-
11-
There are two parts:
12-
13-
- `Markdown.MAML.dll`, a .NET library written in C#.
14-
It does the heavy lifting, like parsing Markdown, transforming it into XML, and so on.
15-
You can open `.\Markdown.MAML.sln` in Visual Studio on any platform.
16-
- A PowerShell module in `.\src\platyPS`.
17-
This module provides the user CLI.
18-
19-
## Build
20-
21-
To build the whole project, use the `build.ps1` helper script.
22-
It depends on the [dotnet cli](https://docs.microsoft.com/en-us/dotnet/core/tools/) build tool.
23-
24-
On Windows you would also need to [install full dotnet framework](https://docs.microsoft.com/en-us/dotnet/framework/install/guide-for-developers) if it's not installed already.
25-
26-
```powershell
27-
.\build.ps1
28-
```
29-
As part of the build, platyPS generates help for itself.
30-
The output of the build is placed in `out\platyPS`.
31-
32-
`build.ps1` also imports the module from `out\platyPS` and generates help itself.
33-
34-
**Note**: if you changed C# code, `build.ps1` will try to overwrite a DLL in use.
35-
You will then need to re-open your PowerShell session.
36-
If you know a better workflow, please suggest it in the Issues.
37-
38-
## Tests
39-
40-
Each part of the project has a test set:
41-
42-
- The C# part has xUnit tests.
43-
You can run them from Visual Studio or from command line with `dotnet test ./test/Markdown.MAML.Test`.
44-
- The PowerShell part has [Pester](https://github.com/pester/Pester) tests.
45-
You can run them with `Invoke-Pester`.
46-
47-
**Note**: Pester tests always force-import the module from the output location of `.\build.ps1`.
48-
49-
## Schema
50-
51-
If you have ideas or concerns about the Markdown schema, feel free to open a GitHub Issue to discuss it.
52-
53-
## Repo structure
54-
55-
- **src\platyPS** - sources to create the final PowerShell module.
56-
- **src\Markdown.MAML, Markdown.MAML.sln** - source code for C# Markdown to MAML converter.
57-
- **[platyPS.schema.md](platyPS.schema.md)** - description of Markdown that platyPS expects.
58-
59-
## Data transformations
60-
61-
Data transformations are the core of platyPS.
62-
A user has content in some form and she wants to transform it into another form.
63-
E.g. transform existing module help (in MAML) to Markdown and use it in the future to generate the external help (MAML) and static HTML for online references.
64-
65-
platyPS provides APIs in the form of cmdlets for end-user scenarios.
66-
These scenarios are assembled from simple transformations.
67-
This chart describes these simple transformations:
68-
69-
```
70-
+----------+
71-
| |
72-
| HTML |
73-
| |
74-
+------^---+
75-
|
76-
+------+------------+ +-----------------+
77-
| | | Markdown Model |
78-
| Markdown file +-----------> |
79-
| | +-+---------------+
80-
| | |
81-
+---------------^---+ |
82-
| |
83-
| |
84-
| |
85-
+--+-----------------v--+
86-
| MAML Model |
87-
| (= Generic Help model)|
88-
| |
89-
+--+-------------------^+
90-
| |
91-
| |
92-
| |
93-
+----------------v-----+ ++--------------------------+
94-
| MAML XML file | | Help Object in PowerShell |
95-
| (External help file) +------------> (+ Get-Command object) |
96-
+----------------------+ +---------------------------+
97-
```
98-
99-
### Example `New-MarkdownHelp`
100-
101-
A user creates a platyPS Markdown for the first time with `New-MarkdownHelp`:
102-
103-
```powershell
104-
New-MarkdownHelp -Command New-MyCommandHelp
105-
```
106-
107-
Under the hood, the following tranformations happen:
108-
109-
[MAML XML file] --> [Help Object + Get-Command object] --> [MAML Model] --> [Markdown file]
110-
111-
# Making a new release
112-
113-
1. Make sure that `CHANGELOG.md` is up-to-date, move section from `UNRELEASED` to new section `<release name>`.
114-
1. Make sure platyPS help itself (content in .\docs folder) is up to date.
115-
`Update-MarkdownHelp -Path .\docs` should result in no changes.
116-
1. Do not change the version in platyps.psd1. Git tag will update this version for release.
117-
1. From master, tag the release.
118-
1. Push tag to GitHub.
119-
1. Find the corresponding build on AppVeyor.
120-
1. Download ZIP archive with the module from Appveyor's Artifacts tab.
121-
1. Unblock the ZIP archive (`Unblock-File foo.zip`), and copy the ZIP's contents to `$env:PSMODULEPATH` so it's available to `Publish-Module`.
122-
1. Publish the module to the Gallery: `Publish-Module -RequiredVersion <version> -Verbose -NuGetApiKey $apiKey`.
123-
1. Check that https://www.powershellgallery.com/packages/platyPS/ updated.
124-
1. Publish a new github release from https://github.com/PowerShell/platyPS/releases to move "Latest release" label to the new tag.
125-
126-
Congratulations! You just made a release.
1+
# Contributing to Microsoft.PowerShell.PlatyPS
2+
3+
This project follow the [Microsoft Open Source Code of Conduct][02]. By participating in this
4+
project, you agree to abide by its terms.
5+
6+
We welcome your contributions and suggestions.
7+
8+
## Contributor License Agreement (CLA)
9+
10+
Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you
11+
have the right to, and actually do, grant us the rights to use your contribution. For more
12+
information, see the [Microsoft CLA][03].
13+
14+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
15+
a CLA. If so, the bot will guide you through the process of signing the CLA.
16+
17+
## Get started
18+
19+
There are several ways to contribute to this project:
20+
21+
- **Report issues**: If you find a bug, please open an issue using the appropriate
22+
[issue template][06].
23+
- **Suggest features**: If you have an idea for a new feature or improvement, please start a
24+
discussion in the [GitHub discussions][05]. When a feature request is approved, a maintainer will
25+
convert the discussion into an issue that can be the basis for a pull request.
26+
- **Submit pull requests**: If you want to contribute code, please fork the repository and submit a
27+
pull request. Pull requests should be based on the `main` branch and include a clear description
28+
of the changes you are proposing. **Pull requests must be linked to an issue to be considered for
29+
merging.**
30+
- **Contribute to documentation**: There are two kinds of documentation:
31+
- **User documentation**: This is the documentation that provide cmdlet reference and usage
32+
information. This documentation is published to [Microsoft Learn][07] and maintained in the
33+
[MicrosoftDocs/PowerShell-Docs-Modules][04] repository.
34+
- **Developer documentation**: This is the documentation aimed at contributors to the PlatyPS
35+
project. It is stored in the `docs` folder of this repository. For more information, see the
36+
[README][01] file in the `docs` folder.
37+
38+
<!-- link references -->
39+
[01]: ./docs/README.md
40+
[02]: CODE_OF_CONDUCT.md
41+
[03]: https://cla.microsoft.com
42+
[04]: https://github.com/MicrosoftDocs/PowerShell-Docs-Modules
43+
[05]: https://github.com/PowerShell/platyPS/discussions
44+
[06]: https://github.com/PowerShell/platyPS/issues/new
45+
[07]: https://learn.microsoft.com/powershell/module/microsoft.powershell.platyps/

README.md

Lines changed: 56 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,82 @@
1-
[![Build status](https://ci.appveyor.com/api/projects/status/u65tnar0cfkmqywl/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/markdown-maml/branch/master)
2-
[![Build status](https://travis-ci.org/PowerShell/platyPS.svg?branch=master)](https://travis-ci.org/PowerShell/platyPS/builds)
1+
# Microsoft.PowerShell.PlatyPS
32

4-
[![Join the chat at https://gitter.im/PowerShell/platyPS](https://badges.gitter.im/PowerShell/platyPS.svg)](https://gitter.im/PowerShell/platyPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3+
**PlatyPS** is the tool that Microsoft uses to create the PowerShell content you get from `Get-Help`
4+
and build the content published as [PowerShell documentation][03] on Microsoft Learn.
55

6-
# PlatyPS
6+
PowerShell help files are stored as [Microsoft Assistance Markup Language][05] (MAML), an XML
7+
format. **PlatyPS** simplifies the authoring process by allowing you to write the help files in
8+
Markdown, then convert to MAML. [Markdown][04] is widely used in the software industry,
9+
supported by many editors including **Visual Studio Code**, and easier to author.
710

8-
PlatyPS provides a way to:
11+
**Microsoft.PowerShell.PlatyPS** includes several improvements:
912

10-
* Write PowerShell External Help in Markdown
11-
* Generate markdown help ([example](docs/Update-MarkdownHelp.md)) for your existing modules
12-
* Keep markdown help up-to-date with your code
13+
- Re-write in C# leveraging [markdig][02] for parsing Markdown (the same library used by
14+
Microsoft Learn to render Markdown)
15+
- Provides a more accurate description of a PowerShell cmdlet and its parameters and includes
16+
information that was previously unavailable
17+
- Creates an object model of the help file that you can manipulate and supports chaining cmdlets for
18+
complex operations
19+
- Increased performance - processes 1000s of Markdown files in seconds
1320

14-
Markdown help docs can be generated from old external help files (also known as MAML-xml help), the command objects (reflection), or both.
21+
## Install Microsoft.PowerShell.PlatyPS
1522

16-
PlatyPS can also generate cab files for [`Update-Help`](https://technet.microsoft.com/en-us/library/hh849720.aspx).
23+
PlatyPS runs on:
1724

18-
## Why?
25+
- Windows PowerShell 5.1+
26+
- PowerShell 7+ on Windows, Linux, and macOS
1927

20-
Traditionally PowerShell external help files have been authored by hand or using complex tool chains and rendered as MAML XML for use as console help.
21-
MAML is cumbersome to edit by hand, and common tools and editors don't support it for complex scenarios like they do with Markdown. PlatyPS is provided as a solution for allow documenting PowerShell help in any editor or tool that supports Markdown.
22-
23-
An additional challenge PlatyPS tackles, is to handle PowerShell documentation for complex scenarios (e.g. very large, closed source, and/or C#/binary modules) where it may be desirable to have documentation abstracted away from the codebase. PlatyPS does not need source access to generate documentation.
24-
25-
Markdown is designed to be human-readable, without rendering. This makes writing and editing easy and efficient.
26-
Many editors support it ([Visual Studio Code](https://code.visualstudio.com/), [Sublime Text](http://www.sublimetext.com/), etc), and many tools and collaboration platforms (GitHub, Visual Studio Online) render the Markdown nicely.
27-
28-
## Common setups
29-
30-
There are 2 common setups that are used:
31-
32-
1. Use markdown as the source of truth and remove other types of help.
33-
2. Keep comment based help as the source of truth and periodically generate markdown for web-site publishing.
34-
35-
They both have advantages and use-cases, you should decide what's right for you.
36-
There is slight preference toward number 1 (markdown as the source).
37-
38-
## Quick start
39-
40-
* Install platyPS module from the [PowerShell Gallery](https://powershellgallery.com):
28+
Install the module from [PSGallery][06].
4129

4230
```powershell
43-
Install-Module -Name platyPS -Scope CurrentUser
44-
Import-Module platyPS
31+
Install-PSResource -Name Microsoft.PowerShell.PlatyPS
4532
```
4633

47-
* Create initial Markdown help for `MyAwesomeModule` module:
34+
## Layout of this repository
4835

49-
```powershell
50-
# you should have module imported in the session
51-
Import-Module MyAwesomeModule
52-
New-MarkdownHelp -Module MyAwesomeModule -OutputFolder .\docs
53-
```
36+
### Branches
5437

55-
* Edit markdown files in `.\docs` folder and populate `{{ ... }}` placeholders with missed help content.
38+
- `main`: Contains the source code for the new version of PlatyPS named
39+
**Microsoft.PowerShell.PlatyPS**. This is the current supported version of PlatyPS. You can find
40+
this version listed as [Microsoft.PowerShell.PlatyPS][06] in the PowerShell Gallery.
41+
- `v1`: Contains the source code for the legacy version of PlatyPS named **platyPS**. This version
42+
is no longer actively maintained, but it's available for reference and legacy support. The latest
43+
version of this code is 0.14.2. You can find this version listed as [platyPS][07] in the
44+
PowerShell Gallery.
5645

57-
* Create external help from markdown help
46+
### Folder structure
5847

59-
```powershell
60-
New-ExternalHelp .\docs -OutputPath en-US\
61-
```
48+
- `docs` - contains design documentation for the PlatyPS project
49+
- `src` - contains the source code for the module
50+
- `test` - contains the tests files used to validate the code at build time
51+
- `tools` - contains tools used to build the module
6252

63-
* **Congratulations**, your help is now in markdown!
53+
## Contributing to the project
6454

65-
* Now, if your module code changes, you can easily update your markdown help with
55+
If you are interested in contributing to the PlatyPS project, please see the
56+
[contribution guide][01].
6657

67-
```powershell
68-
# re-import your module with latest changes
69-
Import-Module MyAwesomeModule -Force
70-
Update-MarkdownHelp .\docs
71-
```
58+
### Build the code
7259

73-
### PlatyPS markdown schema
60+
Prerequisites for build:
7461

75-
Unfortunately, you cannot just write any Markdown, as platyPS expects Markdown to be authored in a **particular way**.
76-
We have defined a [**schema**](platyPS.schema.md) to determine how parameters are described, where scripts examples are shown, and so on.
62+
- PS7
63+
- .NET 8 SDK
7764

78-
The schema closely resembles the existing output format of the `Get-Help` cmdlet in PowerShell.
65+
Prerequisites for test:
7966

80-
If you break the schema in your markdown, you will get error messages from `New-ExternalHelp` and `Update-MarkdownHelp`.
81-
You would not be able to generate extrenal help or update your markdown.
67+
- Pester 4.x (Pester 5.x is not supported)
8268

83-
It may be fine for some scenarios, i.e. you want to have online-only version of markdown.
69+
To build the source code, run the following command in the root of the repository:
8470

85-
## [Usage](docs)
86-
87-
Supported scenarios:
88-
89-
* Create Markdown
90-
* Using existing external help files (MAML schema, XML).
91-
* Using reflection
92-
* Using reflection and existing internal external help files.
93-
* For a single cmdlet
94-
* For an entire module
95-
96-
* Update existing Markdown through reflection.
97-
98-
* Create a module page <ModuleName>.md with summary. It will also allow you to create updatable help cab.
99-
100-
* Retrieve markdown metadata from markdown file.
101-
102-
* Create external help xml files (MAML) from platyPS Markdown.
103-
104-
* Create external help file cab
105-
106-
* Preview help from generated maml file.
107-
108-
## Remoting
109-
110-
PlatyPS supports working with [`Import-PSSession`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-pssession?view=powershell-6) aka implicit remoting.
111-
Just pass `-Session $Session` parameter to the platyPS cmdlets and it will do the rest.
112-
113-
## Build
71+
```powershell
72+
.\build.ps1 -Clean
73+
```
11474

115-
For information about building from sources and contributing see [contributing guidelines](CONTRIBUTING.md).
75+
<!-- link references -->
76+
[01]: ./CONTRIBUTING.md
77+
[02]: https://github.com/xoofx/markdig
78+
[03]: https://learn.microsoft.com/powershell/scripting
79+
[04]: https://wikipedia.org/wiki/Markdown
80+
[05]: https://wikipedia.org/wiki/Microsoft_Assistance_Markup_Language
81+
[06]: https://www.powershellgallery.com/packages/Microsoft.PowerShell.PlatyPS
82+
[07]: https://www.powershellgallery.com/packages/platyPS

0 commit comments

Comments
 (0)