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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mkdocs-material-linter

v1.5.3

Published

markdownlint-cli2 custom rules for validating Material for MkDocs syntax including admonitions, content tabs, and code annotations

Readme

mkdocs-material-linter

npm version CI Status

A markdownlint-cli2 plugin that provides custom rules for validating Material for MkDocs-specific markdown syntax.

Why This Exists

Material for MkDocs extends standard Markdown with powerful features like admonitions (!!!), content tabs (===), and collapsible blocks (???). However, standard markdown linters don't understand this syntax and can't validate it. This leads to:

  • Silent failures - Invalid admonition types that don't render
  • Inconsistent formatting - Mixed indentation breaking content blocks
  • Broken features - Malformed content tabs or annotations that don't work
  • Poor navigation - Heading structures that create confusing documentation sites

This plugin ensures your Material for MkDocs documentation is valid, consistent, and follows best practices before you build your site.

Provided Rules

| Rule Name | Severity | Description | |-----------|----------|-------------| | material-admonition-types | Error | Validates only supported admonition types (note, warning, tip, etc.) | | material-admonition-indentation | Error | Enforces 4-space indentation for admonition content | | material-admonition-empty | Error | Detects admonitions with no content (forgot to indent) | | material-admonition-empty-title | Warning | Prevents empty title quotes in admonitions | | material-content-tabs | Error | Validates === delimiter syntax and tab structure | | material-code-annotations | Warning | Ensures annotation comment style matches code language | | material-navigation-structure | Warning | Checks heading hierarchy and navigation best practices | | material-shell-language-standardization | Warning | Enforces using "shell" instead of "bash" or "sh" for shell code blocks | | material-bundle-exec-shell-type | Warning | Ensures code blocks starting with "bundle exec" use shell language type | | material-blank-lines-spacing | Warning | Ensures blank lines before and after headers and after code blocks | | material-code-block-syntax | Error | Code blocks must have proper syntax - no type on closing tag and all blocks must be closed |

Installation & Usage

Prerequisites

This is a plugin for markdownlint-cli2. You need to have markdownlint-cli2 installed and configured in your project first:

npm install markdownlint-cli2 --save-dev

Installation

npm install mkdocs-material-linter --save-dev
# or
yarn add -D mkdocs-material-linter
# or
pnpm add -D mkdocs-material-linter

Configuration

Add this plugin to your existing .markdownlint-cli2.jsonc configuration:

{
  "customRules": ["mkdocs-material-linter"],
  "config": {
    "material-admonition-types": true,
    "material-admonition-indentation": true,
    "material-admonition-empty": true,
    "material-admonition-empty-title": true,
    "material-code-annotations": true,
    "material-content-tabs": true,
    "material-navigation-structure": true,
    "material-shell-language-standardization": true,
    "material-bundle-exec-shell-type": true,
    "material-blank-lines-spacing": true,
    "material-code-block-syntax": true
  }
}

Running the Linter

# Lint all markdown files
npx markdownlint-cli2

# Lint specific files
npx markdownlint-cli2 "docs/**/*.md"

# Auto-fix issues where possible
npx markdownlint-cli2 --fix

# Add to package.json scripts
"scripts": {
  "lint:docs": "markdownlint-cli2",
  "lint:docs:fix": "markdownlint-cli2 --fix"
}

VS Code Integration

Install the markdownlint extension, then add to .vscode/settings.json:

{
  "markdownlint.customRules": ["mkdocs-material-linter"],
  "markdownlint.config": {
    "material-admonition-types": true,
    "material-admonition-indentation": true,
    "material-admonition-empty": true,
    "material-admonition-empty-title": true,
    "material-code-annotations": true,
    "material-content-tabs": true,
    "material-navigation-structure": true,
    "material-shell-language-standardization": true,
    "material-bundle-exec-shell-type": true,
    "material-blank-lines-spacing": true,
    "material-code-block-syntax": true
  }
}

Advanced Configuration

Each rule can be individually enabled/disabled or configured:

{
  "config": {
    "material-admonition-types": false,
    "material-admonition-indentation": true,
    "material-code-annotations": "warning",
    "material-content-tabs": true,
    "material-navigation-structure": true
  }
}

FAQ

Q: Why do I get errors about missing dependencies? A: Make sure you have markdownlint >= 0.30.0 installed as a peer dependency.

Q: Can I disable specific rules? A: Yes! Set any rule to false in your config or use "off".

Q: Does this work with regular markdownlint (not CLI2)? A: Yes, but markdownlint-cli2 is recommended for better performance and features.

Q: Can I use this with other Material themes? A: This is specifically designed for Material for MkDocs. Other themes may have different syntax.

Development

Testing

npm test        # Run all tests
npm run lint    # Run ESLint

Releasing

# 1. Update version
npm version patch  # or minor/major

# 2. Publish to npm
npm publish

# 3. Create git tag
git push --tags