Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-comments

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-comments - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

29

dist/index.js
'use strict';
var BEGINMARKER = '<--COMMENTS';
var ENDMARKER = 'COMMENTS-->';
var beginMarkerFactory = function beginMarkerFactory() {
var marker = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'COMMENTS';
return '<--' + marker;
};
var endMarkerFactory = function endMarkerFactory() {
var marker = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'COMMENTS';
return marker + '-->';
};
var SPACE = ' ';
function locator(value, fromIndex) {
return value.indexOf(BEGINMARKER, fromIndex);
}
function plugin() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var beginMarker = beginMarkerFactory(opts.beginMarker);
var endMarker = endMarkerFactory(opts.endMarker);
function locator(value, fromIndex) {
return value.indexOf(beginMarker, fromIndex);
}
function inlineTokenizer(eat, value, silent) {
var keepBegin = value.indexOf(BEGINMARKER);
var keepEnd = value.indexOf(ENDMARKER);
var keepBegin = value.indexOf(beginMarker);
var keepEnd = value.indexOf(endMarker);
if (keepBegin !== 0 || keepEnd === -1) return;

@@ -23,4 +32,4 @@

var comment = value.substring(BEGINMARKER.length + 1, keepEnd - 1);
return eat(BEGINMARKER + SPACE + comment + SPACE + ENDMARKER);
var comment = value.substring(beginMarker.length + 1, keepEnd - 1);
return eat(beginMarker + SPACE + comment + SPACE + endMarker);
}

@@ -27,0 +36,0 @@ inlineTokenizer.locator = locator;

{
"name": "remark-comments",
"version": "1.0.1",
"version": "1.0.2",
"repository": {

@@ -5,0 +5,0 @@ "url": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-comments",

@@ -23,2 +23,19 @@ # remark-comments [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status]

## Configuration
Two options can be passed, as a single argument object:
{beginMarker = 'COMMENTS', endMarker = 'COMMENTS'}
Therefore, invoking this plugin this way:
```js
.use(remarkComments, {
beginMarker: 'foo',
endMarker: 'bar'
})
```
will make this plugin remove what's put between `<--foo` and `bar-->`.
## Usage

@@ -25,0 +42,0 @@

@@ -1,14 +0,17 @@

const BEGINMARKER = '<--COMMENTS'
const ENDMARKER = 'COMMENTS-->'
const beginMarkerFactory = (marker = 'COMMENTS') => `<--${marker}`
const endMarkerFactory = (marker = 'COMMENTS') => `${marker}-->`
const SPACE = ' '
function locator (value, fromIndex) {
return value.indexOf(BEGINMARKER, fromIndex)
}
function plugin (opts = {}) {
const beginMarker = beginMarkerFactory(opts.beginMarker)
const endMarker = endMarkerFactory(opts.endMarker)
function plugin (opts = {}) {
function locator (value, fromIndex) {
return value.indexOf(beginMarker, fromIndex)
}
function inlineTokenizer (eat, value, silent) {
const keepBegin = value.indexOf(BEGINMARKER)
const keepEnd = value.indexOf(ENDMARKER)
const keepBegin = value.indexOf(beginMarker)
const keepEnd = value.indexOf(endMarker)
if (keepBegin !== 0 || keepEnd === -1) return

@@ -19,4 +22,4 @@

const comment = value.substring(BEGINMARKER.length + 1, keepEnd - 1)
return eat(BEGINMARKER + SPACE + comment + SPACE + ENDMARKER)
const comment = value.substring(beginMarker.length + 1, keepEnd - 1)
return eat(beginMarker + SPACE + comment + SPACE + endMarker)
}

@@ -23,0 +26,0 @@ inlineTokenizer.locator = locator

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