From 610b32fa34e0c4a2b401ae49c768969f14ed543e Mon Sep 17 00:00:00 2001 From: Michael Lombardi Date: Wed, 17 Aug 2022 13:05:40 -0500 Subject: [PATCH] (AB-4196) Codify markdownlint Prior to this change, the repository had no markdownlint configuration. This change adds configuration based on the rules defined in the MicrosoftDocs/PowerShell-Docs project. The root-folder `.markdownlint.json` file specifies the enforced syntax for Markdown files in this project. The root-folder `.markdownlint-cli2.yaml` file governs the behavior of the linter overall. The settings included are minimal and do not effect the editing experience. This file may require iteration for advanced usage later. In every `About` folder for reference content, this change adds a `.markdownlint.json` file. When editing Markdown in VS Code, the editor uses the closest configuration file to the edited document. That allows us to override and specify alternate rules on a per-folder basis. In this change, the configuration files in the `About` folders: - Extend the root configuration. Any settings not specified in these configurations is inherited from the configuration at the project root. - Overrides the `line-length` rule, setting the maximum line length for code blocks to 74 characters and for other text to 79 characters.This is to accomodate the PowerShell Help System's line length requirements. In the `rules` folder for PSScriptAnalyzer's conceptual content, this change adds a `.markdownlint.json` file which ignores the markdownlint rule `no-emphasis-as-heading`. PSSA rules indicate their severity level by a single line of emphasized text. This change is related to AB#4196 and AB#4197. --- .markdownlint-cli2.yaml | 33 +++++ .markdownlint.json | 132 ++++++++++++++++++ .../PSScriptAnalyzer/Rules/.markdownlint.json | 4 + .../About/.markdownlint.json | 12 ++ .../PlatyPS/About/.markdownlint.json | 12 ++ 5 files changed, 193 insertions(+) create mode 100644 .markdownlint-cli2.yaml create mode 100644 .markdownlint.json create mode 100644 reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json create mode 100644 reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json create mode 100644 reference/ps-modules/PlatyPS/About/.markdownlint.json diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..e3b4e06 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,33 @@ +# Rule definitions live in .markdownlint.json + +# Include a custom rule package +# customRules: +# - markdownlint-rule-titlecase + +# Fix any fixable errors +fix: true + +# Define a custom front matter pattern +# frontMatter: (^---\s*$[^]*?^---\s*$)(\r\n|\r|\n|$) + +# Define glob expressions to use (only valid at root) +# globs: +# - "!*bout.md" + +# Define glob expressions to ignore +ignores: + - breadcrumb + +# Use a plugin to recognize math +# markdownItPlugins: +# - - "@iktakahiro/markdown-it-katex" + +# Disable inline config comments +noInlineConfig: false + +# Disable progress on stdout (only valid at root) +noProgress: true + +# Use a specific formatter (only valid at root) +# outputFormatters: +# - [markdownlint-cli2-formatter-default] diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..cc5c8d2 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,132 @@ +{ + "blanks-around-fences": true, + "blanks-around-headers": true, + "blanks-around-lists": true, + "code-block-style": { + "style": "fenced" + }, + "code-fence-style": { + "style": "backtick" + }, + "commands-show-output": true, + "docsmd.alert": true, + "docsmd.codesnippet": true, + "docsmd.column": true, + "docsmd.image": true, + "docsmd.moniker": true, + "docsmd.no-loc": true, + "docsmd.row": true, + "docsmd.securelinks": true, + "docsmd.syntax": true, + "docsmd.video": true, + "docsmd.xref": true, + "docsmd.zone": true, + "emphasis-style": { + "style": "underscore" + }, + "fenced-code-language": false, + "first-line-h1": { + "front_matter_title": "" + }, + "header-increment": true, + "header-start-left": true, + "header-style": { + "style": "atx" + }, + "hr-style": { + "style": "---" + }, + "line-length": { + "code_block_line_length": 90, + "code_blocks": true, + "heading_line_length": 100, + "headings": true, + "line_length": 100, + "stern": true, + "tables": false + }, + "list-indent": true, + "list-marker-space": true, + "no-alt-text": true, + "no-bare-urls": true, + "no-blanks-blockquote": true, + "no-duplicate-header": { + "siblings_only": true + }, + "no-emphasis-as-header": true, + "no-empty-links": true, + "no-hard-tabs": true, + "no-inline-html": { + "allowed_elements": [ + "a", + "br", + "code", + "kbd", + "li", + "properties", + "sup", + "tags", + "ul" + ] + }, + "no-missing-space-atx": true, + "no-missing-space-closed-atx": true, + "no-multiple-blanks": true, + "no-multiple-space-atx": true, + "no-multiple-space-blockquote": true, + "no-multiple-space-closed-atx": true, + "no-reversed-links": true, + "no-space-in-code": true, + "no-space-in-emphasis": true, + "no-space-in-links": true, + "no-trailing-punctuation": { + "punctuation": ".,;:!。,;:!?" + }, + "no-trailing-spaces": { + "br_spaces": 2, + "strict": true + }, + "ol-prefix": { + "style": "one" + }, + "proper-names": { + "code_blocks": false, + "names": [ + "PowerShell", + "IntelliSense", + "Authenticode", + "CentOS", + "Contoso", + "CoreOS", + "Debian", + "Ubuntu", + "openSUSE", + "RHEL", + "JavaScript", + ".NET", + "NuGet", + "VS Code", + "Newtonsoft" + ] + }, + "required-headers": false, + "single-h1": { + "front_matter_title": "", + "level": 1 + }, + "single-trailing-newline": true, + "strong-style": { + "style": "asterisk" + }, + "ul-indent": { + "indent": 2, + "start_indented": false + }, + "ul-start-left": true, + "ul-style": { + "style": "dash" + }, + "link-fragments": true, + "reference-links-images": true, + "link-image-reference-definitions": true +} diff --git a/reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json b/reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json new file mode 100644 index 0000000..39a15cd --- /dev/null +++ b/reference/docs-conceptual/PSScriptAnalyzer/Rules/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../../.markdownlint.json", + "no-emphasis-as-heading": false +} diff --git a/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json b/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json new file mode 100644 index 0000000..a7af527 --- /dev/null +++ b/reference/ps-modules/Microsoft.PowerShell.Crescendo/About/.markdownlint.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../.markdownlint.json", + "line-length": { + "code_block_line_length": 74, + "code_blocks": true, + "heading_line_length": 79, + "headings": true, + "line_length": 79, + "stern": true, + "tables": false + } +} diff --git a/reference/ps-modules/PlatyPS/About/.markdownlint.json b/reference/ps-modules/PlatyPS/About/.markdownlint.json new file mode 100644 index 0000000..a7af527 --- /dev/null +++ b/reference/ps-modules/PlatyPS/About/.markdownlint.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../.markdownlint.json", + "line-length": { + "code_block_line_length": 74, + "code_blocks": true, + "heading_line_length": 79, + "headings": true, + "line_length": 79, + "stern": true, + "tables": false + } +}