Socket
Socket
Sign inDemoInstall

eslint-plugin-markdown

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-markdown

An ESLint plugin to lint JavaScript in Markdown code fences.


Version published
Maintainers
4
Created

What is eslint-plugin-markdown?

The eslint-plugin-markdown package allows you to lint JavaScript code blocks within Markdown files using ESLint. This is particularly useful for ensuring that code snippets in documentation are up to standard and free of errors.

What are eslint-plugin-markdown's main functionalities?

Linting JavaScript Code Blocks in Markdown

This configuration allows ESLint to process JavaScript code blocks within Markdown files. By specifying the `markdown/markdown` processor, ESLint will recognize and lint the JavaScript code embedded in Markdown.

```json
{
  "overrides": [
    {
      "files": ["**/*.md"],
      "processor": "markdown/markdown"
    }
  ]
}
```

Custom ESLint Rules for Markdown

This configuration applies custom ESLint rules specifically to JavaScript code blocks within Markdown files. In this example, the `no-console` rule is enforced, which will trigger an error if `console` statements are found in the code blocks.

```json
{
  "overrides": [
    {
      "files": ["**/*.md/*.js"],
      "rules": {
        "no-console": "error"
      }
    }
  ]
}
```

Linting Specific Code Blocks

This configuration allows you to lint only specific code blocks within a Markdown file. By defining the `start` and `end` markers, you can control which parts of the Markdown file are subject to linting.

```json
{
  "overrides": [
    {
      "files": ["**/*.md"],
      "processor": "markdown/markdown",
      "settings": {
        "markdown/code-blocks": [
          {
            "language": "js",
            "start": "<!-- eslint-enable -->",
            "end": "<!-- eslint-disable -->"
          }
        ]
      }
    }
  ]
}
```

Other packages similar to eslint-plugin-markdown

Keywords

FAQs

Package last updated on 06 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc