Socket
Socket
Sign inDemoInstall

remark-lint-no-duplicate-headings-in-section

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-no-duplicate-headings-in-section - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

32

index.js

@@ -39,2 +39,18 @@ /**

* 5:1-5:9: Do not use headings with similar content per section (3:1)
*
* @example {"name": "not-ok-tolerant-heading-increment.md", "label": "input"}
*
* # Alpha
*
* #### Bravo
*
* ###### Charlie
*
* #### Bravo
*
* ###### Delta
*
* @example {"name": "not-ok-tolerant-heading-increment.md", "label": "output"}
*
* 7:1-7:11: Do not use headings with similar content per section (3:1)
*/

@@ -59,3 +75,3 @@

function noDuplicateHeadingsInSection(tree, file) {
var stack = [{}]
var stack = []

@@ -66,11 +82,8 @@ visit(tree, 'heading', visitor)

var depth = node.depth
var siblings = stack[depth - 1] || {}
var value = toString(node).toUpperCase()
var duplicate = siblings[value]
var index = depth - 1
var scope = stack[index] || (stack[index] = {})
var duplicate = scope[value]
stack = stack.slice(0, depth)
stack[depth] = {}
siblings[value] = node
if (!generated(node) && duplicate && duplicate.type === 'heading') {
if (!generated(node) && duplicate) {
file.message(

@@ -81,3 +94,6 @@ reason + ' (' + stringify(position.start(duplicate)) + ')',

}
scope[value] = node
stack = stack.slice(0, depth)
}
}
{
"name": "remark-lint-no-duplicate-headings-in-section",
"version": "2.0.1",
"version": "2.0.2",
"description": "remark-lint rule to warn on duplicate headings in a section",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -66,2 +66,24 @@ <!--This file is generated-->

##### `not-ok-tolerant-heading-increment.md`
###### In
```markdown
# Alpha
#### Bravo
###### Charlie
#### Bravo
###### Delta
```
###### Out
```text
7:1-7:11: Do not use headings with similar content per section (3:1)
```
## Install

@@ -68,0 +90,0 @@

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