JSPM

remark-lint-no-long-code

0.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1542
  • Score
    100M100P100Q115975F
  • License MIT

remark lint plugin that warn when line in code block is too long

Package Exports

  • remark-lint-no-long-code

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 (remark-lint-no-long-code) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remark-lint-no-long-code

Warn when any line in code block is too long. By default, the accepted maximum length of each line in code block is 100 characters. You may configure the plugin by

  1. specifying the maximum accepted length of each line, default 100
{
  "length": 100
}
  1. specifying any type of code block that exclude from rule check, default []
{
  "exclude": ["dot", "smali"]
}
  1. specifying the size of tab, default 4
{
  "tabWidth": 4
}

Example

valid.md

In

```javascript
console.log("short line");
```

Out

No messages.

invalid.md

In

# heading

```javascript
console.log("this line contains 101 characters: extra extra extra extra extra extra extra extra ..."),
console.log("short line")
console.log("this line contains 101 characters: extra extra extra extra extra extra extra extra ...")
```

footer with `long long long long long long long long long long long long long long long long long long long long long long long long code`

Out

input.md:4:1-4:101: Maximum length of each code line is 100, but received 101
input.md:6:1-6:101: Maximum length of each code line is 100, but received 101

Install

npm install remark-lint-no-long-code

Usage

You probably want to use it on the CLI through a config file:

 ...
 "remarkConfig": {
   "plugins": [
     ...
     "remark-lint",
+    ["remark-lint-no-long-code", { "length": 100 }]
     ...
   ]
 }
 ...

Or use it on the CLI directly

remark -u remark-lint -u remark-lint-no-long-code readme.md

Or use this on the API:

 var remark = require('remark');
 var report = require('vfile-reporter');

 remark()
   .use(require('remark-lint'))
+  .use(require('remark-lint-no-long-code'), { length: 100 })
   .process('_Emphasis_ and **importance**', function (err, file) {
     console.error(report(err || file));
   });

License

MIT © LaySent