npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

markdownlint-cli2-formatter-template

v0.0.2

Published

An output formatter for markdownlint-cli2 that displays results using a template

Downloads

4,796

Readme

markdownlint-cli2-formatter-template

An output formatter for markdownlint-cli2 that displays results using a template.

npm version License

Install

npm install markdownlint-cli2-formatter-template --save-dev

Use

This output formatter makes it easy to custom-format linting violations. To specify an output format, set the template parameter to a string with text and one or more tokens representing any of the following elements. The specified template will be applied once for each violation.

These tokens are always defined:

| Token | Meaning | |-------------------|-----------------------| | fileName | File name | | lineNumber | Line number (1-based) | | ruleName | Rule name (full) | | ruleDescription | Rule description | | ruleInformation | Informational URL |

These tokens are sometimes defined (depending on the rule/violation):

| Token | Meaning | |----------------|-------------------------| | columnNumber | Column number (1-based) | | errorContext | Context information | | errorDetail | Additional detail |

In the simplest case, tokens are specified with the syntax ${token}. This is all that's needed for tokens that are always defined. To support scenarios where a token may not be defined, the syntaxes ${token:text if present} and ${token!text if not present} are also supported. This allows for templates to accommodate missing data. Only one level of token nesting is supported.

A few examples demonstrate the concept:

| Template | Output if defined | Output if not defined | |--------------------------------------------------------------------------|-------------------|-----------------------| | Column=${columnNumber} | Column=10 | Column= | | ${columnNumber:Column=${columnNumber}} | Column=10 | | | ${columnNumber!No column number} | | No column number | | ${columnNumber:Column=${columnNumber}}${columnNumber!No column number} | Column=10 | No column number |

Example

To output in the Azure Pipelines Task command LogIssue format, use something like the following .markdownlint-cli2.jsonc:

{
  "outputFormatters": [
    [
      "markdownlint-cli2-formatter-template",
      {
        "template": "##vso[task.logissue type=error;sourcepath=${fileName};linenumber=${lineNumber};${columnNumber:columnumber=${columnNumber};}code=${ruleName}]${ruleDescription}"
      }
    ]
  ]
}

Which produces output like:

##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=3;columnumber=10;code=MD009/no-trailing-spaces]Trailing spaces
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=5;code=MD012/no-multiple-blanks]Multiple consecutive blank lines
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=6;code=MD025/single-title/single-h1]Multiple top-level headings in the same document
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=12;columnumber=4;code=MD019/no-multiple-space-atx]Multiple spaces after hash on atx style heading
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=14;columnumber=14;code=MD047/single-trailing-newline]Files should end with a single newline character