Skip to content

Commit

Permalink
Update formatter-pretty to use yellow instead of gray for rule name a…
Browse files Browse the repository at this point in the history
…nd details/context for better visual contrast (fixes #321).
  • Loading branch information
DavidAnson committed May 20, 2024
1 parent 47e31eb commit 7766fa1
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
26 changes: 13 additions & 13 deletions formatter-pretty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ To append informational links to the output instead (which may be clickable):
<!-- markdownlint-disable line-length no-inline-html no-space-in-code -->

<pre style="background:black">
<span style="color:purple">dir/about.md</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:gray">MD021/no-multiple-space-closed-atx</span><span style="color:white"> Multiple spaces inside hashes on closed atx style heading</span><span style="color:gray"> [Context: &quot;# About #&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/about.md</span><span style="color:teal">:</span><span style="color:green">4</span><span style="color:white"> </span><span style="color:gray">MD032/blanks-around-lists</span><span style="color:white"> Lists should be surrounded by blank lines</span><span style="color:gray"> [Context: &quot;1. List&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/about.md</span><span style="color:teal">:</span><span style="color:green">5</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:gray">MD029/ol-prefix</span><span style="color:white"> Ordered list item prefix</span><span style="color:gray"> [Expected: 2; Actual: 3; Style: 1/2/3]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:gray">MD022/blanks-around-headings/blanks-around-headers</span><span style="color:white"> Headings should be surrounded by blank lines</span><span style="color:gray"> [Expected: 1; Actual: 0; Below] [Context: &quot;## Information&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:gray">MD041/first-line-heading/first-line-h1</span><span style="color:white"> First line in a file should be a top-level heading</span><span style="color:gray"> [Context: &quot;## Information&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">2</span><span style="color:teal">:</span><span style="color:green">6</span><span style="color:white"> </span><span style="color:gray">MD038/no-space-in-code</span><span style="color:white"> Spaces inside code span elements</span><span style="color:gray"> [Context: &quot;` code1`&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">2</span><span style="color:teal">:</span><span style="color:green">20</span><span style="color:white"> </span><span style="color:gray">MD038/no-space-in-code</span><span style="color:white"> Spaces inside code span elements</span><span style="color:gray"> [Context: &quot;`code2 `&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">4</span><span style="color:white"> </span><span style="color:gray">MD012/no-multiple-blanks</span><span style="color:white"> Multiple consecutive blank lines</span><span style="color:gray"> [Expected: 1; Actual: 2]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">3</span><span style="color:teal">:</span><span style="color:green">10</span><span style="color:white"> </span><span style="color:gray">MD009/no-trailing-spaces</span><span style="color:white"> Trailing spaces</span><span style="color:gray"> [Expected: 0 or 2; Actual: 1]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">5</span><span style="color:white"> </span><span style="color:gray">MD012/no-multiple-blanks</span><span style="color:white"> Multiple consecutive blank lines</span><span style="color:gray"> [Expected: 1; Actual: 2]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">6</span><span style="color:white"> </span><span style="color:gray">MD025/single-title/single-h1</span><span style="color:white"> Multiple top-level headings in the same document</span><span style="color:gray"> [Context: &quot;# Description&quot;]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">12</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:gray">MD019/no-multiple-space-atx</span><span style="color:white"> Multiple spaces after hash on atx style heading</span><span style="color:gray"> [Context: &quot;## Summary&quot;]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">14</span><span style="color:teal">:</span><span style="color:green">14</span><span style="color:white"> </span><span style="color:gray">MD047/single-trailing-newline</span><span style="color:white"> Files should end with a single newline character
<span style="color:purple">dir/about.md</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:yellow">MD021/no-multiple-space-closed-atx</span><span style="color:white"> Multiple spaces inside hashes on closed atx style heading</span><span style="color:yellow"> [Context: &quot;# About #&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/about.md</span><span style="color:teal">:</span><span style="color:green">4</span><span style="color:white"> </span><span style="color:yellow">MD032/blanks-around-lists</span><span style="color:white"> Lists should be surrounded by blank lines</span><span style="color:yellow"> [Context: &quot;1. List&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/about.md</span><span style="color:teal">:</span><span style="color:green">5</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:yellow">MD029/ol-prefix</span><span style="color:white"> Ordered list item prefix</span><span style="color:yellow"> [Expected: 2; Actual: 3; Style: 1/2/3]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:yellow">MD022/blanks-around-headings/blanks-around-headers</span><span style="color:white"> Headings should be surrounded by blank lines</span><span style="color:yellow"> [Expected: 1; Actual: 0; Below] [Context: &quot;## Information&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:yellow">MD041/first-line-heading/first-line-h1</span><span style="color:white"> First line in a file should be a top-level heading</span><span style="color:yellow"> [Context: &quot;## Information&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">2</span><span style="color:teal">:</span><span style="color:green">6</span><span style="color:white"> </span><span style="color:yellow">MD038/no-space-in-code</span><span style="color:white"> Spaces inside code span elements</span><span style="color:yellow"> [Context: &quot;` code1`&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">2</span><span style="color:teal">:</span><span style="color:green">20</span><span style="color:white"> </span><span style="color:yellow">MD038/no-space-in-code</span><span style="color:white"> Spaces inside code span elements</span><span style="color:yellow"> [Context: &quot;`code2 `&quot;]</span><span style="color:white">
</span><span style="color:purple">dir/subdir/info.md</span><span style="color:teal">:</span><span style="color:green">4</span><span style="color:white"> </span><span style="color:yellow">MD012/no-multiple-blanks</span><span style="color:white"> Multiple consecutive blank lines</span><span style="color:yellow"> [Expected: 1; Actual: 2]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">3</span><span style="color:teal">:</span><span style="color:green">10</span><span style="color:white"> </span><span style="color:yellow">MD009/no-trailing-spaces</span><span style="color:white"> Trailing spaces</span><span style="color:yellow"> [Expected: 0 or 2; Actual: 1]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">5</span><span style="color:white"> </span><span style="color:yellow">MD012/no-multiple-blanks</span><span style="color:white"> Multiple consecutive blank lines</span><span style="color:yellow"> [Expected: 1; Actual: 2]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">6</span><span style="color:white"> </span><span style="color:yellow">MD025/single-title/single-h1</span><span style="color:white"> Multiple top-level headings in the same document</span><span style="color:yellow"> [Context: &quot;# Description&quot;]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">12</span><span style="color:teal">:</span><span style="color:green">1</span><span style="color:white"> </span><span style="color:yellow">MD019/no-multiple-space-atx</span><span style="color:white"> Multiple spaces after hash on atx style heading</span><span style="color:yellow"> [Context: &quot;## Summary&quot;]</span><span style="color:white">
</span><span style="color:purple">viewme.md</span><span style="color:teal">:</span><span style="color:green">14</span><span style="color:teal">:</span><span style="color:green">14</span><span style="color:white"> </span><span style="color:yellow">MD047/single-trailing-newline</span><span style="color:white"> Files should end with a single newline character
</span></pre>

[chalk]: https://github.com/chalk/chalk
Expand Down
4 changes: 2 additions & 2 deletions formatter-pretty/markdownlint-cli2-formatter-pretty.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const outputFormatter = async (options, params) => {
chalk.green(lineNumber) +
(column ? chalk.cyan(":") + chalk.green(column) : "") +
" " +
chalk.gray(ruleText) +
chalk.yellow(ruleText) +
" " +
ruleDescription +
chalk.gray(detailsAndContext) +
chalk.yellow(detailsAndContext) +
(appendText.length > 0 ? chalk.blueBright(appendText) : "")
);
}
Expand Down
2 changes: 1 addition & 1 deletion formatter-pretty/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "markdownlint-cli2-formatter-pretty",
"version": "0.0.5",
"version": "0.0.6",
"description": "An output formatter for markdownlint-cli2 that looks like markdownlint-cli2-formatter-default with color and clickable links",
"author": {
"name": "David Anson",
Expand Down
Loading

0 comments on commit 7766fa1

Please sign in to comment.