Socket
Socket
Sign inDemoInstall

remark-lint-no-table-indentation

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-no-table-indentation - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

49

index.js

@@ -9,2 +9,10 @@ /**

*
* ## Fix
*
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify)
* removes all unneeded indentation before tables.
*
* See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "valid.md"}

@@ -32,31 +40,36 @@ *

'use strict';
'use strict'
var rule = require('unified-lint-rule');
var visit = require('unist-util-visit');
var position = require('unist-util-position');
var generated = require('unist-util-generated');
var rule = require('unified-lint-rule')
var visit = require('unist-util-visit')
var position = require('unist-util-position')
var generated = require('unist-util-generated')
module.exports = rule('remark-lint:no-table-indentation', noTableIndentation);
module.exports = rule('remark-lint:no-table-indentation', noTableIndentation)
function noTableIndentation(ast, file) {
visit(ast, 'table', visitor);
var reason = 'Do not indent table rows'
function noTableIndentation(tree, file) {
var contents = String(file)
visit(tree, 'table', visitor)
function visitor(node) {
var contents = file.toString();
if (generated(node)) {
return;
if (!generated(node)) {
node.children.forEach(each)
}
node.children.forEach(each);
return visit.SKIP
}
function each(row) {
var fence = contents.slice(position.start(row).offset, position.start(row.children[0]).offset);
function each(row) {
var fence = contents.slice(
position.start(row).offset,
position.start(row.children[0]).offset
)
if (fence.indexOf('|') > 1) {
file.message('Do not indent table rows', row);
}
if (fence.indexOf('|') > 1) {
file.message(reason, row)
}
}
}
{
"name": "remark-lint-no-table-indentation",
"version": "1.0.1",
"version": "1.0.2",
"description": "remark-lint rule to warn when tables are indented",

@@ -13,4 +13,4 @@ "license": "MIT",

],
"repository": "https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-table-indentation",
"bugs": "https://github.com/wooorm/remark-lint/issues",
"repository": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-table-indentation",
"bugs": "https://github.com/remarkjs/remark-lint/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

@@ -17,0 +17,0 @@ "contributors": [

@@ -7,2 +7,10 @@ <!--This file is generated-->

## Fix
[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify)
removes all unneeded indentation before tables.
See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
on how to automatically fix warnings for this rule.
## Presets

@@ -14,3 +22,3 @@

| ------ | ------- |
| [`remark-preset-lint-markdown-style-guide`](https://github.com/wooorm/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | |
| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | |

@@ -101,2 +109,2 @@ ## Example

[MIT](https://github.com/wooorm/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com)
[MIT](https://github.com/remarkjs/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com)
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