You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
4.4 KiB

# Write documentation
7 years ago
The NTFSSecurity documentation is written in Markdown and built into a
website with [MkDocs][mkdocs]. This page explains how the documentation is
organized and how to change it.
## Documentation structure
| Path | Content |
| --- | --- |
| `Docs/index.md` | Home page with features, requirements, and the cmdlet list |
| `Docs/Concepts.md` | Background on security descriptors, rights, inheritance, and privileges |
| `Docs/Examples.md` | Task-oriented examples |
| `Docs/Cmdlets/*.md` | One reference page per cmdlet, in platyPS format |
| `Docs/Contributing.md`, `Docs/Contributing/*.md` | This contributor guide |
| `mkdocs.yml` | Site settings and navigation |
| `.readthedocs.yml` | Build settings for Read the Docs |
| `README.md` | Front page of the GitHub repository |
When you add a page, add it to the `nav` section of `mkdocs.yml`.
7 years ago
## Markdown editors
Any text editor works. These editors have good Markdown support:
- [Visual Studio Code](https://code.visualstudio.com) with the
[markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
extension
- [Sublime Text](https://www.sublimetext.com/)
To get started with Markdown, see
[How to use Markdown for writing Docs](https://learn.microsoft.com/contribute/content/markdown-reference).
Don't use hard tabs. For the rules that apply to this repository, see
[Markdown and platyPS specifics](04-Markdown-Specifics.md).
## Update the cmdlet reference
The pages in `Docs/Cmdlets` are [platyPS][platyps] Markdown files. platyPS
reads the parameter metadata from the module, so the syntax and the parameter
details always match the code. You write the synopsis, the description, the
parameter descriptions, the examples, and the notes.
When a cmdlet changes, build the module, import the build output, and update
the pages in Windows PowerShell 5.1. A Release build writes the module to
`NTFSSecurity\bin\Release`:
```powershell
Install-Module -Name platyPS -RequiredVersion 0.14.2
Import-Module -Name .\NTFSSecurity\bin\Release\NTFSSecurity.psd1
Update-MarkdownHelp -Path .\Docs\Cmdlets
```
`Update-MarkdownHelp` updates the syntax and the parameter metadata and keeps
the text that you wrote. Fill in the description of every new parameter.
Use Windows PowerShell 5.1 for platyPS. In PowerShell 7.4 and later,
platyPS 0.14.2 adds the `-ProgressAction` common parameter to every page.
For a new cmdlet, create the page, replace every placeholder in it, and add
the page to `mkdocs.yml`. Replace `Get-NTFSExample` with the name of the new
cmdlet:
```powershell
New-MarkdownHelp -Command Get-NTFSExample -OutputFolder .\Docs\Cmdlets
```
To check that the pages can be converted to the help file that `Get-Help`
reads, run `New-ExternalHelp`:
```powershell
New-ExternalHelp -Path .\Docs\Cmdlets -OutputPath $env:TEMP\NTFSSecurityHelp
```
## Preview the website
7 years ago
MkDocs needs Python. Install the MkDocs version that the site is built with
and start the preview server:
7 years ago
```powershell
pip install -r Docs/requirements.txt
mkdocs serve
```
7 years ago
Open `http://127.0.0.1:8000` in a browser. The preview reloads when you save
a file. Run `mkdocs build --strict` to find broken links and pages that are
missing from the navigation.
7 years ago
## Check your change
7 years ago
Before you open a pull request, check the following:
7 years ago
- No page in `Docs/Cmdlets` contains a `{{ ... }}` placeholder.
- `Update-MarkdownHelp` doesn't change any page in `Docs/Cmdlets`. The build
defined in `appveyor.yml` runs the same check.
- All links work. The build checks them with `Get-MarkdownLink` from the
MarkdownLinkCheck module:
7 years ago
```powershell
Get-MarkdownLink -Path .\Docs -BrokenOnly
```
7 years ago
- Every example works. Test examples in a test folder, never on production
data.
7 years ago
## Create new topics
7 years ago
Before you write a new topic, check the issues labeled
[Documentation][label-documentation] or [Help Wanted][label-help-wanted] to
make sure nobody else is working on it. If nobody is, open an issue that
describes the topic and say that you're working on it. Then follow the
workflow for larger changes in [Get started](01-Getting-Started.md).
7 years ago
## Next steps
7 years ago
Read the [Style guide](03-Style-Guide.md).
7 years ago
<!-- External URLs -->
[mkdocs]: https://www.mkdocs.org/user-guide/writing-your-docs/
[platyps]: https://github.com/PowerShell/platyPS
[label-documentation]: https://github.com/raandree/NTFSSecurity/labels/Documentation
[label-help-wanted]: https://github.com/raandree/NTFSSecurity/labels/Help%20Wanted