JSPM

  • Created
  • Published
  • Downloads 560053
  • Score
    100M100P100Q172544F
  • License MIT

An ESLint plugin to lint JavaScript in Markdown code fences.

Package Exports

  • eslint-plugin-markdown

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-markdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

eslint-plugin-markdown

Screenshot

Join the chat at https://gitter.im/eslint/eslint-plugin-markdown

An ESLint plugin to lint JavaScript in Markdown.

Supported extensions are .markdown, .mdown, .mkdn, and .md.

Usage

Install the plugin:

npm install --save-dev eslint eslint-plugin-markdown

Add it to your .eslintrc:

{
    "plugins": [
        "markdown"
    ]
}

Run ESLint on .md files:

eslint --ext md .

It will lint js, javascript, jsx, or node fenced code blocks in your Markdown documents:

```js
// This gets linted
var answer = 6 * 7;
console.log(answer);
```

```JavaScript
// This also gets linted

/* eslint quotes: [2, "double"] */

function hello() {
    console.log("Hello, world!");
}
hello();
```

```jsx
// This gets linted too
var div = <div className="jsx"></div>;
```

```node
// And this
console.log(process.version);
```

Blocks that don't specify either js, javascript, jsx, or node syntax are ignored:

```
This is plain text and doesn't get linted.
```

```python
print("This doesn't get linted either.")
```

Unsatisfiable Rules

Since code blocks are not files themselves but embedded inside a Markdown document, some rules do not apply to Markdown code blocks, and messages from these rules are automatically suppressed:

  • eol-last

Contributing

$ git clone https://github.com/eslint/eslint-plugin-markdown.git
$ cd eslint-plugin-markdown
$ npm link
$ npm link eslint-plugin-markdown
$ npm test

This project follows the ESLint contribution guidelines.