Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.

  • 5.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
548K
decreased by-1.2%
Maintainers
4
Weekly downloads
 
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 11 Jul 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