Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

ssb-marked

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-marked - npm Package Compare versions

Comparing version
0.5.4
to
0.6.0
+39
-9
lib/marked.js

@@ -30,2 +30,3 @@ /**

block.checkbox = /^\[([ x])\] +/;
block.bullet = /(?:[*+-]|\d+\.)/;

@@ -160,3 +161,4 @@ block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;

, i
, l;
, l
, checked;

@@ -308,2 +310,13 @@ while (src) {

if (this.options.gfm) {
checked = block.checkbox.exec(item);
if (checked) {
checked = checked[1] === 'x';
item = item.replace(block.checkbox, '');
} else {
checked = undefined;
}
}
// Outdent whatever the

@@ -338,2 +351,3 @@ // list item contains. Hacky.

this.tokens.push({
checked: checked,
type: loose

@@ -885,9 +899,19 @@ ? 'loose_item_start'

Renderer.prototype.list = function(body, ordered) {
Renderer.prototype.list = function(body, ordered, taskList) {
var type = ordered ? 'ol' : 'ul';
return '<' + type + '>\n' + body + '</' + type + '>\n';
var classes = taskList ? ' class="task-list"' : '';
return '<' + type + classes + '>\n' + body + '</' + type + '>\n';
};
Renderer.prototype.listitem = function(text) {
return '<li>' + text + '</li>\n';
Renderer.prototype.listitem = function(text, checked) {
if (checked === undefined) {
return '<li>' + text + '</li>\n';
}
return '<li class="task-list-item">'
+ '<input type="checkbox" class="task-list-item-checkbox"'
+ (checked ? ' checked' : '')
+ '> '
+ text
+ '</li>\n';
};

@@ -1116,12 +1140,18 @@

var body = ''
, taskList = false
, ordered = this.token.ordered;
while (this.next().type !== 'list_end') {
if (this.token.checked !== undefined) {
taskList = true;
}
body += this.tok();
}
return this.renderer.list(body, ordered);
return this.renderer.list(body, ordered, taskList);
}
case 'list_item_start': {
var body = '';
var body = ''
, checked = this.token.checked;

@@ -1134,3 +1164,3 @@ while (this.next().type !== 'list_item_end') {

return this.renderer.listitem(body);
return this.renderer.listitem(body, checked);
}

@@ -1144,3 +1174,3 @@ case 'loose_item_start': {

return this.renderer.listitem(body);
return this.renderer.listitem(body, checked);
}

@@ -1147,0 +1177,0 @@ case 'html': {

+1
-1

@@ -10,3 +10,3 @@ {

],
"version": "0.5.4",
"version": "0.6.0",
"main": "./lib/marked.js",

@@ -13,0 +13,0 @@ "bin": "./bin/marked",

@@ -191,3 +191,4 @@ # marked

- hr()
- list(*string* body, *boolean* ordered)
- list(*string* body, *boolean* ordered, *boolean* taskList)
- `taskList` true when `gfm` is `true` and there is a list item with a check box
- listitem(*string* text)

@@ -215,3 +216,4 @@ - paragraph(*string* text)

- del(*string* text)
- link(*string* href, *string* title, *string* text)
- link(*string* href, *string* title, *string* text, [*boolean* checked]).
- `checked` only defined when `gfm` is `true` and there is a check box at the start of the list item (e.g. `* [ ] foo`).
- image(*string* href, *string* title, *string* text)

@@ -218,0 +220,0 @@