Socket
Socket
Sign inDemoInstall

remark-lint-no-inline-padding

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-no-inline-padding - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

40

index.js

@@ -27,33 +27,25 @@ /**

'use strict';
'use strict'
var rule = require('unified-lint-rule');
var visit = require('unist-util-visit');
var generated = require('unist-util-generated');
var toString = require('mdast-util-to-string');
var rule = require('unified-lint-rule')
var visit = require('unist-util-visit')
var generated = require('unist-util-generated')
var toString = require('mdast-util-to-string')
module.exports = rule('remark-lint:no-inline-padding', noInlinePadding);
module.exports = rule('remark-lint:no-inline-padding', noInlinePadding)
function noInlinePadding(ast, file) {
visit(ast, visitor);
function noInlinePadding(tree, file) {
visit(tree, ['emphasis', 'strong', 'delete', 'image', 'link'], visitor)
function visitor(node) {
var type = node.type;
var contents;
var contents
if (generated(node)) {
return;
}
if (!generated(node)) {
contents = toString(node)
if (
type === 'emphasis' ||
type === 'strong' ||
type === 'delete' ||
type === 'image' ||
type === 'link'
) {
contents = toString(node);
if (contents.charAt(0) === ' ' || contents.charAt(contents.length - 1) === ' ') {
file.message('Don’t pad `' + type + '` with inner spaces', node);
if (
contents.charAt(0) === ' ' ||
contents.charAt(contents.length - 1) === ' '
) {
file.message('Don’t pad `' + node.type + '` with inner spaces', node)
}

@@ -60,0 +52,0 @@ }

6

package.json
{
"name": "remark-lint-no-inline-padding",
"version": "1.0.1",
"version": "1.0.2",
"description": "remark-lint rule to warn when inline nodes are padded with spaces",

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

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

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

@@ -16,4 +16,4 @@ <!--This file is generated-->

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

@@ -95,2 +95,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