Skip to content

Commit

Permalink
(AB-4196) Codify markdownlint (#92)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaeltlombardi authored Aug 18, 2022
1 parent 03065d1 commit e74c14a
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -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]
132 changes: 132 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../../../.markdownlint.json",
"no-emphasis-as-heading": false
}
Original file line number Diff line number Diff line change
@@ -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
}
}
12 changes: 12 additions & 0 deletions reference/ps-modules/PlatyPS/About/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit e74c14a

Please sign in to comment.