Socket
Socket
Sign inDemoInstall

remarked

Package Overview
Dependencies
18
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1-beta to 0.1.2

.travis.yml

54

.verbrc.md

@@ -7,18 +7,52 @@ # {%= name %} {%= badge('fury') %}

{%= include("install", {save: '--save'}) %}
{%= include("install-npm", {save: 'save'}) %}
## Goals
- [x] Unit tests
- [ ] Better test coverage (started). Many more tests are needed, I'd also like to move the code inline instead of reading from files wherever reasonable.
- [x] Cleaner more organized code-base (started)
- [ ] Well-commented code
- [ ] Remove extra tags/attributes from generated HTML (e.g. heading ids) (started)
- [ ] Refactor options handling
- [ ] Allow extensions/plugins
## [Why?](#why-)
## Usage
Minimal usage:
```js
var markdown = require('remarked');
console.log(markdown('I am using **markdown**.'));
//=> <p>I am using <strong>markdown</strong>.</p>
```
## API
### .setOptions
Define remarked options with:
```js
remarked.setOptions({})
```js
var remarked = require('remarked');
remarked.setOptions({
renderer: new remarked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false
});
console.log(remarked('I am using **markdown**.'));
```
## Why?
Assemble used marked.js extensively, but given the massive amount of time and effort that we've put into fixing marked-related issues (due to breaking changes that were introduced without bumping the minor version), we've decided to maintain a fork so that our user base can have a more reliable experience going forward.
Assemble used [marked.js](https://github.com/chjj/marked) extensively, but - for a couple of reasons - we've decided to maintain a fork so that our users can have a more reliable experience going forward.
1. There are bugs, like [escaping quotes](https://github.com/chjj/marked/issues/269#issuecomment-47995414) automatically that prevent us from making marked.js a built-in parser.
1. Given the massive amount of time and effort that we've put into fixing marked-related issues on the Assemble project and related projects
1. Breaking changes are introduced to marked.js without bumping the minor version
1. It does too much or too little with certain features. Like [automatically adding ids to headings](https://github.com/chjj/marked/pull/181)
## Author

@@ -25,0 +59,0 @@

4

bower.json
{
"name": "slapdash",
"version": "0.1.0-beta",
"name": "remarked",
"version": "0.1.2",
"main": [

@@ -5,0 +5,0 @@ "index.js"

@@ -14,8 +14,9 @@ /*!

var Lexer = require('./lib/lexer');
var defaults = require('./lib/defaults');
var Parser = require('./lib/parser');
var Lexer = require('./lib/lexer-block');
var InlineLexer = require('./lib/lexer-inline');
var Renderer = require('./lib/renderer');
var InlineLexer = require('./lib/inline-lexer');
var defaults = require('./lib/defaults');
var utils = require('./lib/utils/helpers');
var merge = require('./lib/utils/merge');

@@ -28,3 +29,3 @@

function remarked(src, options, callback) {
if (callback || typeof options === 'function') {
if (typeof options === 'function' || callback) {
if (!callback) {

@@ -35,3 +36,3 @@ callback = options;

options = utils._merge({}, defaults, options || {});
options = merge({}, defaults, options);

@@ -51,3 +52,3 @@ var highlight = options.highlight;

var done = function (err) {
var cb = function (err) {
if (err) {

@@ -72,3 +73,3 @@ options.highlight = highlight;

if (!highlight || highlight.length < 3) {
return done();
return cb();
}

@@ -79,32 +80,32 @@

if (!pending) {
return done();
return cb();
}
for (; i < pending; i++) {
(function (token) {
if (token.type !== 'code') {
return --pending || done();
for (; i < pending; i += 1) {
var token = tokens[i];
if (token.type !== 'code') {
return (pending -= 1) || cb();
}
return highlight(token.text, token.lang, function (err, code) {
if (err) {
return cb(err);
}
return highlight(token.text, token.lang, function (err, code) {
if (err) {
return done(err);
}
if (code == null || code === token.text) {
return --pending || done();
}
token.text = code;
token.escaped = true;
--pending || done();
});
})(tokens[i]);
if (code === null || code === token.text) {
return (pending -= 1) || cb();
}
token.text = code;
token.escaped = true;
(pending -= 1) || cb();
});
}
return;
}
try {
if (options) {
options = utils._merge({}, defaults, options);
options = merge({}, defaults, options);
}
return Parser.parse(Lexer.lex(src, options), options);
} catch (e) {
e.message += '\n[remarked]: please report this to https://github.com/jonschlinkert/remarked.';
e.message += '\n [remarked]: please report this to https://github.com/jonschlinkert/remarked.';
if ((options || defaults).silent) {

@@ -122,4 +123,4 @@ return '<p>An error occured:</p><pre>' + utils._escape(e.message + '', true) + '</pre>';

remarked.options = remarked.setOptions = function(options) {
utils._merge(defaults, options);
return remarked;
merge(defaults, options);
return this;
};

@@ -130,3 +131,2 @@

/**

@@ -133,0 +133,0 @@ * Expose

@@ -6,2 +6,6 @@ /*!

* Licensed under the MIT license.
*
* Based on marked <https://github.com/chjj/marked>
* Copyright (c) 2011-2014, Christopher Jeffrey, contributors.
* Released under the MIT License (MIT)
*/

@@ -8,0 +12,0 @@

@@ -6,2 +6,6 @@ /*!

* Licensed under the MIT license.
*
* Based on marked <https://github.com/chjj/marked>
* Copyright (c) 2011-2014, Christopher Jeffrey, contributors.
* Released under the MIT License (MIT)
*/

@@ -13,23 +17,30 @@

var Renderer = require('./renderer');
var InlineLexer = require('./inline-lexer');
var InlineLexer = require('./lexer-inline');
/**
* Parsing & Compiling
* ## Parser
*
* The main parsing and compiling class in remarked.
*
* @class `Parser`
* @constructor
*/
function Parser(options) {
var Parser = module.exports = function Parser(options) {
this.tokens = [];
this.token = null;
this.options = options || defaults;
this.options.renderer = this.options.renderer || new Renderer;
this._options = options || defaults;
this._options.renderer = this._options.renderer || new Renderer(this._options);
this.renderer = this.options.renderer;
this.renderer.options = this.options;
}
this.renderer = this._options.renderer;
this.renderer.options = this._options;
};
/**
* Static Parse Method
* ## .parse
*
* @static `parse` method
*/

@@ -48,5 +59,4 @@

Parser.prototype.parse = function (src) {
this.inline = new InlineLexer(src.links, this.options, this.renderer);
this.inline = new InlineLexer(src.links, this._options, this.renderer);
this.tokens = src.reverse();
var out = '';

@@ -56,3 +66,2 @@ while (this.next()) {

}
return out;

@@ -101,27 +110,18 @@ };

switch (this.token.type) {
case 'space': {
case 'space':
return '';
}
case 'hr': {
case 'hr':
return this.renderer.hr();
}
case 'heading': {
case 'heading':
return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, this.token.text);
}
case 'code': {
case 'code':
return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
}
case 'table': {
case 'table':
var i, row, cell, flags, j;
header = '';
body = '';
// header
// Table headers
cell = '';
for (i = 0; i < this.token.header.length; i++) {
for (i = 0; i < this.token.header.length; i += 1) {
flags = {

@@ -131,30 +131,25 @@ header: true,

};
cell += this.renderer.tablecell(
this.inline.output(this.token.header[i]), {
header: true,
align: this.token.align[i]
}
);
cell += this.renderer.tablecell(this.inline.output(this.token.header[i]), {
header: true,
align: this.token.align[i]
});
}
header += this.renderer.tablerow(cell);
for (i = 0; i < this.token.cells.length; i++) {
for (i = 0; i < this.token.cells.length; i += 1) {
row = this.token.cells[i];
cell = '';
for (j = 0; j < row.length; j++) {
cell += this.renderer.tablecell(
this.inline.output(row[j]), {
header: false,
align: this.token.align[j]
}
);
for (j = 0; j < row.length; j += 1) {
cell += this.renderer.tablecell(this.inline.output(row[j]), {
header: false,
align: this.token.align[j]
});
}
body += this.renderer.tablerow(cell);
}
return this.renderer.table(header, body);
}
case 'blockquote_start': {
case 'blockquote_start':
body = '';

@@ -165,5 +160,3 @@ while (this.next().type !== 'blockquote_end') {

return this.renderer.blockquote(body);
}
case 'list_start': {
case 'list_start':
var ordered = this.token.ordered;

@@ -175,5 +168,3 @@ body = '';

return this.renderer.list(body, ordered);
}
case 'list_item_start': {
case 'list_item_start':
body = '';

@@ -184,5 +175,3 @@ while (this.next().type !== 'list_item_end') {

return this.renderer.listitem(body);
}
case 'loose_item_start': {
case 'loose_item_start':
body = '';

@@ -193,20 +182,14 @@ while (this.next().type !== 'list_item_end') {

return this.renderer.listitem(body);
}
case 'html': {
var html = !this.token.pre && !this.options.pedantic ? this.inline.output(this.token.text) : this.token.text;
case 'html':
var html = !this.token.pre
&& !this._options.pedantic
? this.inline.output(this.token.text)
: this.token.text;
return this.renderer.html(html);
}
case 'paragraph': {
case 'paragraph':
return this.renderer.paragraph(this.inline.output(this.token.text));
}
case 'text': {
case 'text':
return this.renderer.paragraph(this.parseText());
}
break;
}
};
module.exports = Parser;
};

@@ -6,2 +6,6 @@ /*!

* Licensed under the MIT license.
*
* Based on marked <https://github.com/chjj/marked>
* Copyright (c) 2011-2014, Christopher Jeffrey, contributors.
* Released under the MIT License (MIT)
*/

@@ -11,6 +15,6 @@

var template = require('template');
var templates = require('./templates');
var slugify = require('./utils/slugify');
var utils = require('./utils/helpers');
var templates = require('./templates');
var template = require('template');

@@ -25,7 +29,14 @@

function Renderer(options) {
options = options || {};
this.options = options;
}
var Renderer = function Renderer(options) {
this.options = options || {};
};
/**
* ## .code
*
* @param {String} `code`
* @param {String} `lang`
* @param {Boolean} `escaped`
* @return {String}
*/

@@ -49,2 +60,9 @@ Renderer.prototype.code = function (code, lang, escaped) {

/**
* ## .blockquote
*
* @param {String} `quote`
* @return {String}
*/
Renderer.prototype.blockquote = function (quote) {

@@ -55,2 +73,9 @@ return template(templates.blockquote, {quote: quote});

/**
* ## .html
*
* @param {String} `html`
* @return {String}
*/
Renderer.prototype.html = function (html) {

@@ -61,3 +86,21 @@ return html;

/**
* ## .heading
*
* @param {String} `quote` The heading text.
* @param {Number} `level` Heading level (e.g. h1, h2, h3...)
* @param {Boolean} `raw`
* @return {String}
*/
Renderer.prototype.heading = function (text, level, raw) {
// var obj = {
// slugify: slugify,
// tag: 'h' + level,
// level: level,
// text: text,
// raw: raw
// };
// console.log(makeTag(obj));
return template(templates.heading, {

@@ -72,2 +115,10 @@ slugify: slugify,

/**
* ## .hr
*
* Define `xhtml: true` in the options to generate xhtml, e.g. `<hr/>`.
*
* @return {String} `<hr>` | `<hr/>`
*/
Renderer.prototype.hr = function () {

@@ -78,2 +129,10 @@ return this.options.xhtml ? '<hr/>\n' : '<hr>\n';

/**
* ## .list
*
* @param {String} `body`
* @param {Boolean} `ordered` List type. Set to `true` for ordered lists.
* @return {String}
*/
Renderer.prototype.list = function (body, ordered) {

@@ -85,2 +144,9 @@ var type = ordered ? 'ol' : 'ul';

/**
* ## .listitme
*
* @param {String} `text`
* @return {String}
*/
Renderer.prototype.listitem = function (text) {

@@ -91,2 +157,9 @@ return '<li>' + text + '</li>\n';

/**
* ## .paragraph
*
* @param {String} `txt`
* @return {String}
*/
Renderer.prototype.paragraph = function (text) {

@@ -97,2 +170,10 @@ return '<p>' + text + '</p>\n';

/**
* ## .table
*
* @param {String} `header`
* @param {String} `body`
* @return {String}
*/
Renderer.prototype.table = function (header, body) {

@@ -103,2 +184,9 @@ return '<table>\n' + '<thead>\n' + header + '</thead>\n' + '<tbody>\n' + body + '</tbody>\n' + '</table>\n';

/**
* ## .tablerow
*
* @param {String} `content`
* @return {String}
*/
Renderer.prototype.tablerow = function (content) {

@@ -109,2 +197,10 @@ return '<tr>\n' + content + '</tr>\n';

/**
* ## .tablecell
*
* @param {String} `content`
* @param {String} `flags`
* @return {String}
*/
Renderer.prototype.tablecell = function (content, flags) {

@@ -117,3 +213,11 @@ var type = flags.header ? 'th' : 'td';

// span level renderer
/**
* ## .strong
*
* Span level renderer.
*
* @param {String} `txt`
* @return {String}
*/
Renderer.prototype.strong = function (text) {

@@ -124,2 +228,11 @@ return '<strong>' + text + '</strong>';

/**
* ## .em
*
* Span level renderer.
*
* @param {String} `txt`
* @return {String}
*/
Renderer.prototype.em = function (text) {

@@ -130,2 +243,11 @@ return '<em>' + text + '</em>';

/**
* ## .codespan
*
* Span level renderer.
*
* @param {String} `txt`
* @return {String}
*/
Renderer.prototype.codespan = function (text) {

@@ -136,2 +258,10 @@ return '<code>' + text + '</code>';

/**
* ## .br
*
* Span level renderer.
*
* @return {String} `<br/>` | `<br>`
*/
Renderer.prototype.br = function () {

@@ -142,2 +272,11 @@ return this.options.xhtml ? '<br/>' : '<br>';

/**
* ## .del
*
* Span level renderer.
*
* @param {String} `text`
* @return {String}
*/
Renderer.prototype.del = function (text) {

@@ -148,8 +287,19 @@ return '<del>' + text + '</del>';

/**
* ## .link
*
* Span level renderer.
*
* @param {String} `href`
* @param {String} `title`
* @param {String} `text`
* @return {String}
*/
Renderer.prototype.link = function (href, title, text) {
var prot;
if (this.options.sanitize) {
try {
prot = decodeURIComponent(utils._unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
text = utils._unescape(text);
} catch (e) {

@@ -162,20 +312,36 @@ return '';

}
var out = '<a href="' + href + '"';
var html = '<a href="' + href + '"';
if (title) {
out += ' title="' + title + '"';
html += ' title="' + title + '"';
}
out += '>' + text + '</a>';
return out;
html += '>' + text + '</a>';
return html;
};
Renderer.prototype.image = function (href, title, text) {
var out = '<img src="' + href + '" alt="' + text + '"';
/**
* ## .image
*
* Span level renderer.
*
* @param {String} `href`
* @param {String} `title`
* @param {String} `alt`
* @return {String}
*/
Renderer.prototype.image = function (href, title, alt) {
var html = '<img src="' + href + '" alt="' + alt + '"';
if (title) {
out += ' title="' + title + '"';
html += ' title="' + title + '"';
}
out += this.options.xhtml ? '/>' : '>';
return out;
html += this.options.xhtml ? '/>' : '>';
return html;
};
module.exports = Renderer;
/**
* Expose `Renderer`
*/
module.exports = Renderer;
module.exports = {
blockquote: require('./blockquote'),
heading: require('./heading'),
heading: require('./heading')
};

@@ -6,2 +6,6 @@ /*!

* Licensed under the MIT license.
*
* Based on marked <https://github.com/chjj/marked>
* Copyright (c) 2011-2014, Christopher Jeffrey, contributors.
* Released under the MIT License (MIT)
*/

@@ -12,85 +16,5 @@

exports._noop = function () {};
exports._noop.exec = exports._noop;
/**
* Escape HTML.
*
* @param {String} `html`
* @param {String} `encode`
* @return {String}
*/
exports._escape = function (html, encode) {
html = html
.replace(!encode ? new RegExp('&(?!#?\\w+;)', 'g') : /&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
return html;
};
/**
* Unescape HTML
*
* @param {String} `html`
* @return {String}
*/
exports._unescape = function (html) {
return html.replace(/&([#\w]+);/g, function (_, n) {
n = n.toLowerCase();
if (n === 'colon') {
return ':';
}
if (n.charAt(0) === '#') {
return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
}
return '';
});
};
exports._replace = function (regex, options) {
regex = regex.source;
options = options || '';
return function self(name, val) {
if (!name) {
return new RegExp(regex, options);
}
val = val.source || val;
val = val.replace(/(^|[^\[])\^/g, '$1');
regex = regex.replace(name, val);
return self;
};
};
/**
* Merge `obj` into the given objects.
*
* @param {Object} `obj`
* @return {Object}
* @api public
*/
exports._merge = function (obj) {
var i = 1;
var target;
var key;
var len = arguments.length;
for (; i < len; i++) {
target = arguments[i];
for (key in target) {
if (Object.prototype.hasOwnProperty.call(target, key)) {
obj[key] = target[key];
}
}
}
return obj;
};
exports._noop.exec = function () {};
exports._escape = require('./escape');
exports._unescape = require('./unescape');
exports._merge = require('./merge');

@@ -11,34 +11,41 @@ /*!

var nativeTrim = String.prototype.trim;
var specialChars = require('regexp-special-chars');
var escapeRegExp = function (str) {
function escapeRe (str) {
if (str == null) {
return '';
}
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};
return String(str)
.replace(specialChars, '\\$1');
}
var defaultToWhiteSpace = function (characters) {
if (characters == null) {
function defaultToWhiteSpace (chars) {
if (chars == null) {
return '\\s';
} else if (characters.source) {
return characters.source;
} else if (chars.source) {
return chars.source;
} else {
return '[' + escapeRegExp(characters) + ']';
return '[' + escapeRe(chars) + ']';
}
};
}
var trim = function (str, characters) {
var trim = function (str, chars) {
if (str == null) {return ''; }
if (!characters && nativeTrim) {
return nativeTrim.call(str);
if (!chars && String.prototype.trim) {
return String.prototype.trim.call(str);
}
characters = defaultToWhiteSpace(characters);
return String(str).replace(new RegExp('^' + characters + '+|' + characters + '+$', 'g'), '');
chars = defaultToWhiteSpace(chars);
var re = new RegExp('^' + chars + '+|' + chars + '+$', 'g');
return String(str).replace(re, '');
};
var dasherize = function(str){
return trim(str).replace(/([A-Z])/g, '-$1').replace(/[-_\s]+/g, '-').toLowerCase();
return trim(str)
.replace(/([A-Z])/g, '-$1')
.replace(/[-_\s]+/g, '-')
.toLowerCase();
};
var from = "ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź";
var to = "aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz";

@@ -49,4 +56,3 @@ module.exports = function (str) {

}
var from = "ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź";
var to = "aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz";
var regex = new RegExp(defaultToWhiteSpace(from), 'g');

@@ -57,3 +63,4 @@ str = String(str).toLowerCase().replace(regex, function (c) {

});
return dasherize(str.replace(/[^\w\s-]/g, ''));
str = str.replace(/[^\w\s-]/g, '');
return dasherize(str);
};

@@ -6,2 +6,6 @@ /*!

* Licensed under the MIT license.
*
* Based on marked <https://github.com/chjj/marked>
* Copyright (c) 2011-2014, Christopher Jeffrey, contributors.
* Released under the MIT License (MIT)
*/

@@ -8,0 +12,0 @@

{
"name": "remarked",
"description": "Markdown parser and lexer (fork of marked.js).",
"version": "0.1.1-beta",
"description": "Markdown parser and lexer. This is a fork of marked.js maintained for Assemble.",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/remarked",

@@ -23,7 +23,14 @@ "author": {

],
"bin": {
"deps": "./bin/remarked.js"
},
"keywords": [
"compile",
"compiler",
"docs",
"documentation",
"markdown",
"marked"
"marked",
"parse",
"parser"
],

@@ -43,9 +50,14 @@ "main": "index.js",

"gulp-mocha": "^0.4.1",
"highlight.js": "^8.0.0",
"js-beautify": "^1.5.1",
"lodash": "^2.4.1",
"mocha": "~1.18.2"
"mocha": "~1.18.2",
"verb": "^0.2.13"
},
"dependencies": {
"minimist": "^0.2.0",
"regexp-special-chars": "^0.1.0",
"strings": "^0.4.1",
"template": "^0.2.1"
}
}
# remarked [![NPM version](https://badge.fury.io/js/remarked.png)](http://badge.fury.io/js/remarked)
> Markdown parser and lexer (fork of marked.js).
> Markdown parser and lexer. This is a fork of marked.js maintained for Assemble.
## Install
Install with [npm](npmjs.org):
#### [npm](npmjs.org)
```bash
npm i remarked --save-dev
npm i remarked --save
```
## Goals
- [x] Unit tests
- [ ] Better test coverage (started). Many more tests are needed, I'd also like to move the code inline instead of reading from files wherever reasonable.
- [x] Cleaner more organized code-base (started)
- [ ] Well-commented code
- [ ] Remove extra tags/attributes from generated HTML (e.g. heading ids) (started)
- [ ] Refactor options handling
- [ ] Allow extensions/plugins
## [Why?](#why-)
## Usage
Minimal usage:
```js
var markdown = require('remarked');
console.log(markdown('I am using **markdown**.'));
//=> <p>I am using <strong>markdown</strong>.</p>
```
## API
### .setOptions
Define remarked options with:
```js
remarked.setOptions({})
```js
var remarked = require('remarked');
remarked.setOptions({
renderer: new remarked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false
});
console.log(remarked('I am using **markdown**.'));
```
## Why?
Assemble used marked.js extensively, but given the massive amount of time and effort that we've put into fixing marked-related issues (due to breaking changes that were introduced without bumping the minor version), we've decided to maintain a fork so that our user base can have a more reliable experience going forward.
Assemble used [marked.js](https://github.com/chjj/marked) extensively, but - for a couple of reasons - we've decided to maintain a fork so that our users can have a more reliable experience going forward.
1. There are bugs, like [escaping quotes](https://github.com/chjj/marked/issues/269#issuecomment-47995414) automatically that prevent us from making marked.js a built-in parser.
1. Given the massive amount of time and effort that we've put into fixing marked-related issues on the Assemble project and related projects
1. Breaking changes are introduced to marked.js without bumping the minor version
1. It does too much or too little with certain features. Like [automatically adding ids to headings](https://github.com/chjj/marked/pull/181)
## Author

@@ -46,2 +80,2 @@

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 02, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 03, 2014._

@@ -55,3 +55,3 @@ Markdown: Basics

====================
A Second Level Header

@@ -66,7 +66,7 @@ ---------------------

dog's back.
### Header 3
> This is a blockquote.
>
>
> This is the second paragraph in the blockquote.

@@ -80,19 +80,19 @@ >

<h1>A First Level Header</h1>
<h2>A Second Level Header</h2>
<p>Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.</p>
<p>The quick brown fox jumped over the lazy
dog's back.</p>
<h3>Header 3</h3>
<blockquote>
<p>This is a blockquote.</p>
<p>This is the second paragraph in the blockquote.</p>
<h2>This is an H2 in a blockquote</h2>

@@ -111,3 +111,3 @@ </blockquote>

Some of these words _are emphasized also_.
Use two asterisks for **strong emphasis**.

@@ -120,8 +120,8 @@ Or, if you prefer, __use two underscores instead__.

Some of these words <em>are emphasized also</em>.</p>
<p>Use two asterisks for <strong>strong emphasis</strong>.
Or, if you prefer, <strong>use two underscores instead</strong>.</p>
## Lists ##

@@ -177,3 +177,3 @@

* A list item.
With multiple paragraphs.

@@ -190,5 +190,5 @@

</ul>
### Links ###

@@ -286,3 +286,3 @@

<code>&lt;blink&gt;</code> tags.</p>
<p>I wish SmartyPants used named entities like

@@ -310,3 +310,3 @@ <code>&amp;mdash;</code> instead of decimal-encoded

you've got to put paragraph tags in your blockquotes:</p>
<pre><code>&lt;blockquote&gt;

@@ -313,0 +313,0 @@ &lt;p&gt;For example.&lt;/p&gt;

@@ -49,3 +49,3 @@ Markdown: Syntax

document should be publishable as-is, as plain text, without looking
like it's been marked up with tags or formatting instructions. While
like it's been remarked up with tags or formatting instructions. While
Markdown's syntax has been influenced by several existing text-to-HTML

@@ -258,3 +258,3 @@ filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],

> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse

@@ -286,8 +286,8 @@ > id sem consectetuer libero luctus adipiscing.

> ## This is a header.
>
>
> 1. This is the first list item.
> 2. This is the second list item.
>
>
> Here's some example code:
>
>
> return shell_exec("echo $input | $markdown_script");

@@ -537,3 +537,3 @@

*****
- - -

@@ -639,3 +639,3 @@

And then define the link:
[Daring Fireball]: http://daringfireball.net/

@@ -764,3 +764,3 @@

A single backtick in a code span: `` ` ``
A backtick-delimited string in a code span: `` `foo` ``

@@ -771,3 +771,3 @@

<p>A single backtick in a code span: <code>`</code></p>
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>

@@ -843,3 +843,3 @@

<http://example.com/>
Markdown will turn this into:

@@ -846,0 +846,0 @@

@@ -32,3 +32,15 @@ /**

/**
* Normalize newlines
* Read a file in the `test/expected` directory.
*
* @param {String} `filepath`
* @return {String}
*/
utils.readExpected = function(filepath) {
var src = path.join('test/expected', filepath);
return file.readFileSync(src);
};
/**
* Remove spaces
* @param {String} str

@@ -38,3 +50,3 @@ * @return {String}

utils.normalize = function(str) {
utils.stripSpaces = function(str) {
return str.replace(/\s+/g, '');

@@ -44,5 +56,5 @@ };

utils.writeActual = function(dir, test, actual) {
var dest = path.join('test/actual', dir, test + '.html');
file.writeFileSync(dest, actual);
utils.writeActual = function(test, filename) {
var dest = path.join('test/actual', test + '.html');
file.writeFileSync(dest, filename);
};
#!/usr/bin/env node
/**
* marked tests
* remarked tests
* Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)

@@ -16,3 +16,3 @@ * https://github.com/chjj/marked

var _ = require('lodash');
var marked = require('../');
var remarked = require('../');
var helpers = require('./helpers/utils');

@@ -66,4 +66,4 @@

}
if (marked.defaults.hasOwnProperty(key)) {
marked.defaults[key] = val;
if (remarked.defaults.hasOwnProperty(key)) {
remarked.defaults[key] = val;
}

@@ -80,3 +80,3 @@ });

engine = engine || marked;
engine = engine || remarked;
options = options || {};

@@ -93,3 +93,3 @@ var files = options.files || load(),

if (options.marked) {
marked.setOptions(options.marked);
remarked.setOptions(options.marked);
}

@@ -101,5 +101,5 @@

if (marked._original) {
marked.defaults = marked._original;
delete marked._original;
if (remarked._original) {
remarked.defaults = remarked._original;
delete remarked._original;
}

@@ -110,6 +110,6 @@

if (flags.length) {
marked._original = marked.defaults;
marked.defaults = {};
remarked._original = remarked.defaults;
remarked.defaults = {};
marked.defaults = _.extend({}, marked._original);
remarked.defaults = _.extend({}, remarked._original);

@@ -221,3 +221,3 @@ _flags(flags);

// Non-GFM, Non-pedantic
marked.setOptions({
remarked.setOptions({
gfm: false,

@@ -231,8 +231,8 @@ tables: false,

if (options.marked) {
marked.setOptions(options.marked);
remarked.setOptions(options.marked);
}
bench('marked', marked);
bench('remarked', remarked);
// GFM
marked.setOptions({
remarked.setOptions({
gfm: true,

@@ -246,8 +246,8 @@ tables: false,

if (options.marked) {
marked.setOptions(options.marked);
remarked.setOptions(options.marked);
}
bench('marked (gfm)', marked);
bench('remarked (gfm)', remarked);
// Pedantic
marked.setOptions({
remarked.setOptions({
gfm: false,

@@ -261,5 +261,5 @@ tables: false,

if (options.marked) {
marked.setOptions(options.marked);
remarked.setOptions(options.marked);
}
bench('marked (pedantic)', marked);
bench('remarked (pedantic)', remarked);

@@ -315,5 +315,5 @@ // robotskirt

if (options.marked) {
marked.setOptions(options.marked);
remarked.setOptions(options.marked);
}
bench('marked', marked);
bench('remarked', remarked);
}

@@ -399,3 +399,3 @@

// markdown does some strange things.
// it does not encode naked `>`, marked does.
// it does not encode naked `>`, remarked does.
(function () {

@@ -478,3 +478,3 @@ var file = dir + '/amps_and_angles_encoding.html';

var opt = utils.camelize(arg.replace(/^--(no-)?/, ''));
if (!marked.defaults.hasOwnProperty(opt)) {
if (!remarked.defaults.hasOwnProperty(opt)) {
continue;

@@ -484,5 +484,5 @@ }

if (arg.indexOf('--no-') === 0) {
options.marked[opt] = typeof marked.defaults[opt] !== 'boolean' ? null : false;
options.marked[opt] = typeof remarked.defaults[opt] !== 'boolean' ? null : false;
} else {
options.marked[opt] = typeof marked.defaults[opt] !== 'boolean' ? argv.shift() : true;
options.marked[opt] = typeof remarked.defaults[opt] !== 'boolean' ? argv.shift() : true;
}

@@ -527,3 +527,3 @@ } else {

if (!module.parent) {
process.title = 'marked';
process.title = 'remarked';
process.exit(main(process.argv.slice()) ? 0 : 1);

@@ -530,0 +530,0 @@ } else {

@@ -8,8 +8,12 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
// console.log(remarked)
/**

@@ -20,11 +24,9 @@ * Blockquotes

describe('blockquotes:', function () {
describe('when an angle bracket is the first thing on a line', function () {
it('should convert to a blockquote', function (done) {
it('should convert to a blockquote', function () {
var fixture = '> This is a blockquote';
var actual = marked(fixture);
var actual = remarked(fixture);
var expected = '<blockquote>\n<p>This is a blockquote</p>\n</blockquote>\n';
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -34,11 +36,10 @@ });

describe('blockquote_list_item', function () {
it('should convert blockquote_list_item', function (done) {
it('should convert blockquote_list_item', function () {
var testfile = 'blockquote_list_item';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -48,11 +49,10 @@ });

describe('blockquotes_with_code_blocks', function () {
it('should convert blockquotes_with_code_blocks', function (done) {
it('should convert blockquotes_with_code_blocks', function () {
var testfile = 'blockquotes_with_code_blocks';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -62,11 +62,10 @@ });

describe('lazy_blockquotes', function () {
it('should convert lazy_blockquotes', function (done) {
it('should convert lazy_blockquotes', function () {
var testfile = 'lazy_blockquotes';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -76,11 +75,10 @@ });

describe('nested_blockquotes', function () {
it('should convert nested_blockquotes', function (done) {
it('should convert nested_blockquotes', function () {
var testfile = 'nested_blockquotes';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -91,13 +89,12 @@ });

describe('blockquotes_embedded_lists', function () {
it('should convert blockquotes_embedded_lists', function (done) {
it('should convert blockquotes_embedded_lists', function () {
var testfile = 'blockquotes_embedded_lists';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * Language tests

describe('code_blocks', function () {
it('should convert code_blocks', function (done) {
it('should convert code_blocks', function () {
var testfile = 'code_blocks';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,11 +36,10 @@ });

describe('code_spans', function () {
it('should convert code_spans', function (done) {
it('should convert code_spans', function () {
var testfile = 'code_spans';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -49,11 +49,10 @@ });

describe('nested_code', function () {
it('should convert nested_code', function (done) {
it('should convert nested_code', function () {
var testfile = 'nested_code';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -64,13 +63,12 @@ });

describe('when code is indented by tabs', function () {
it('should correctly determine tabs and convert to html', function (done) {
it('should correctly determine tabs and convert to html', function () {
var testfile = 'tabs';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * complex

describe('complex_mixture', function () {
it('should convert complex_mixture', function (done) {
it('should convert complex_mixture', function () {
var testfile = 'complex_mixture';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,11 +36,10 @@ });

describe('markdown_documentation_basics', function () {
xit('should convert markdown_documentation_basics', function (done) {
it('should convert markdown_documentation_basics', function () {
var testfile = 'markdown_documentation_basics';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -49,13 +49,12 @@ });

describe('markdown_documentation_syntax', function () {
it('should convert markdown_documentation_syntax', function (done) {
it('should convert markdown_documentation_syntax', function () {
var testfile = 'markdown_documentation_syntax';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,7 +8,8 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;

@@ -19,10 +20,9 @@ /**

describe('remarked', function () {
describe('custom', function () {
describe('when a string is passed', function () {
it('should be parsed as markdown and return HTML', function (done) {
it('should be parsed as markdown and return HTML', function () {
var fixture = 'foo';
var actual = marked(fixture);
helper.writeActual('extras/inline', 'string', actual);
var actual = remarked(fixture);
helper.writeActual('inline/string', actual);
expect(actual).to.deep.equal('<p>foo</p>\n');
done();
});

@@ -32,8 +32,7 @@ });

describe('when a heading is passed', function () {
it('should return HTML with standard ', function (done) {
it('should return HTML with standard ', function () {
var fixture = '**foo**';
var actual = marked(fixture);
helper.writeActual('extras/inline', 'bold', actual);
var actual = remarked(fixture);
helper.writeActual('inline/bold', actual);
expect(actual).to.deep.equal('<p><strong>foo</strong></p>\n');
done();
});

@@ -43,8 +42,7 @@ });

describe('when a custom heading with random junk is passed', function () {
it('should return customized HTML', function (done) {
it('should return customized HTML', function () {
var fixture = '# One (Two) | Three';
var actual = marked(fixture);
helper.writeActual('extras/inline', 'heading-with-junk', actual);
var actual = remarked(fixture);
helper.writeActual('inline/heading-with-junk', actual);
expect(actual).to.deep.equal('<h1 id="one-two-three">One (Two) | Three</h1>\n');
done();
});

@@ -54,34 +52,16 @@ });

describe('when code is passed with an explicitly defined language', function () {
xit('should return customized HTML', function (done) {
it('should append the defined language to the class in the `code` tag', function () {
var fixture = '```css\n.foo {color: red;}```';
var actual = marked(fixture);
helper.writeActual('extras/inline', 'code-block-css', actual);
expect(actual).to.deep.equal('.foo {color: red;}');
done();
var actual = remarked(fixture);
var expected = '<pre><code class="lang-css">.foo {color: red;}\n</code></pre>\n';
expect(actual).to.deep.equal(expected);
});
});
describe('when code is passed with an explicitly defined language', function () {
xit('should return customized HTML', function (done) {
var highlight = function (code) {
return require('highlight.js').highlightAuto(code).value;
};
var fixture = '```css\n.foo {color: red;}```';
var actual = marked(fixture, {highlight: highlight});
helper.writeActual('extras/inline', 'highlight-explicit-lang-css', actual);
expect(actual).to.deep.equal('.foo {color: red;}');
done();
it('should append the defined language to the class in the `code` tag', function () {
var fixture = '```zzz\n.foo {color: red;}```';
var actual = remarked(fixture);
var expected = '<pre><code class="lang-zzz">.foo {color: red;}\n</code></pre>\n';
expect(actual).to.deep.equal(expected);
});
});
describe('when code is passed with an explicitly defined custom language', function () {
xit('should return customized HTML', function (done) {
var fixture = '```less\n.foo {color: red;}```';
var actual = marked(fixture);
helper.writeActual('extras/inline', 'highlight-explicit-lang-less', actual);
expect(actual).to.deep.equal('.foo {color: red;}');
done();
});
});
});

@@ -8,9 +8,11 @@ /**

const expect = require('chai').expect;
const pretty = require('js-beautify').html;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
const prettify = !!~process.argv.indexOf('foo');
'use strict';
var expect = require('chai').expect;
var pretty = require('js-beautify').html;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
var prettify = !!~process.argv.indexOf('foo');
var arr = ['one', 'two', 'three'];

@@ -32,8 +34,8 @@ !!~arr.indexOf('two')

describe('def_blocks', function () {
it('should convert def_blocks', function (done) {
xdescribe('def_blocks', function () {
it('should convert def_blocks', function () {
var fixture = helper.readFile('def_blocks' + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', 'def_blocks', actual);
helper.writeActual('def_blocks', actual);
var expected = helper.readFile('def_blocks' + '.html');

@@ -40,0 +42,0 @@ expect(normalize(actual)).to.equal(normalize(expected));

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * emphasis

describe('nested_em', function () {
it('should convert nested_em', function (done) {
it('should convert nested_em', function () {
var testfile = 'nested_em';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,13 +36,12 @@ });

describe('strong_and_em_together', function () {
it('should convert strong_and_em_together', function (done) {
it('should convert strong_and_em_together', function () {
var testfile = 'strong_and_em_together';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * escaping

describe('backslash_escapes', function () {
it('should convert backslash_escapes', function (done) {
var testfile = 'backslash_escapes';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
it('should convert backslash_escapes', function () {
var fixture = helper.readFile('backslash_escapes.md');
var expected = helper.readFile('backslash_escapes.html');
helper.writeActual('extras', testfile, actual);
var expected = helper.readFile(testfile + '.html');
var actual = remarked(fixture);
helper.writeActual('backslash_escapes', actual);
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,14 +36,17 @@ });

describe('when an angle bracket is escaped', function () {
it('it should be preserved in the rendered HTML', function (done) {
var actual = marked('\\>');
it('it should be preserved in the rendered HTML', function () {
var actual = remarked('\\>');
expect(actual).to.deep.equal('<p>></p>\n');
done();
});
xit('it should be preserved in the rendered HTML', function (done) {
var actual = marked('\\<\\>');
it('it should be preserved in the rendered HTML', function () {
var actual = remarked('\\<');
expect(actual).to.deep.equal('<p><</p>\n');
});
it('it should be preserved in the rendered HTML', function () {
var actual = remarked('\\<\\>');
expect(actual).to.deep.equal('<p><></p>\n');
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * GitHub flavored markdown

describe('gfm_toplevel_paragraphs', function () {
it('should convert gfm_toplevel_paragraphs', function (done) {
it('should convert gfm_toplevel_paragraphs', function () {
var testfile = 'gfm_toplevel_paragraphs';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,11 +36,10 @@ });

describe('gfm_break', function () {
it('should convert gfm_break', function (done) {
it('should convert gfm_break', function () {
var testfile = 'gfm_break.breaks';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -49,11 +49,10 @@ });

describe('gfm_code', function () {
it('should convert gfm_code', function (done) {
it('should convert gfm_code', function () {
var testfile = 'gfm_code';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -63,11 +62,10 @@ });

describe('gfm_code_hr_list', function () {
it('should convert gfm_code_hr_list', function (done) {
it('should convert gfm_code_hr_list', function () {
var testfile = 'gfm_code_hr_list';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -77,11 +75,10 @@ });

describe('gfm_del', function () {
it('should convert gfm_del', function (done) {
it('should convert gfm_del', function () {
var testfile = 'gfm_del';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -91,11 +88,10 @@ });

describe('gfm_em', function () {
it('should convert gfm_em', function (done) {
it('should convert gfm_em', function () {
var testfile = 'gfm_em';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -105,11 +101,10 @@ });

describe('gfm_links', function () {
it('should convert gfm_links', function (done) {
it('should convert gfm_links', function () {
var testfile = 'gfm_links';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -119,13 +114,12 @@ });

describe('gfm_tables', function () {
it('should convert gfm_tables', function (done) {
it('should convert gfm_tables', function () {
var testfile = 'gfm_tables';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,28 +23,16 @@ * headings

describe('headings', function () {
it('should convert headings', function (done) {
it('should convert headings', function () {
var markdown = '# Heading\n\nText';
var html = '<h1 id="heading">Heading</h1>\n<p>Text</p>\n';
var actual = marked(markdown);
var actual = remarked(markdown);
expect(actual).to.deep.equal(html);
done();
});
});
describe('custom headings', function () {
xit('should convert custom headings', function (done) {
it('should convert custom headings', function () {
var markdown = '# Heading\n\nText';
var html = [
'<h1>',
' <a name="heading" class="anchor" href="#heading">',
' <span class="header-link"></span>',
' </a>Heading',
'</h1><p>Text</p>\n'
].join('\n');
var actual = marked(markdown);
expect(actual).to.deep.equal(html);
done();
var actual = remarked(markdown);
expect(actual).to.deep.equal('<h1 id="heading">Heading</h1>\n<p>Text</p>\n');
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * horizontal rules

describe('horizontal_rules', function () {
it('should convert horizontal_rules', function (done) {
it('should convert horizontal_rules', function () {
var testfile = 'horizontal_rules';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,13 +36,12 @@ });

describe('hr_list_break', function () {
it('should convert hr_list_break', function (done) {
it('should convert hr_list_break', function () {
var testfile = 'hr_list_break';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * inline HTML

describe('inline_html_advanced', function () {
it('should convert inline_html_advanced', function (done) {
it('should convert inline_html_advanced', function () {
var testfile = 'inline_html_advanced';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,11 +36,10 @@ });

describe('inline_html_comments', function () {
it('should convert inline_html_comments', function (done) {
it('should convert inline_html_comments', function () {
var testfile = 'inline_html_comments';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -49,11 +49,10 @@ });

describe('inline_html_simple', function () {
it('should convert inline_html_simple', function (done) {
it('should convert inline_html_simple', function () {
var testfile = 'inline_html_simple';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -60,0 +59,0 @@ });

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -20,26 +22,13 @@ * links

describe('links', function () {
describe('autolinks', function () {
it('should convert autolinks to a tags, wrapped in paragraph tags', function (done) {
var fixture = '<http://example.com>';
var actual = marked(fixture);
it('should convert autolinks to a tags, wrapped in paragraph tags', function () {
var actual = remarked('<http://example.com>');
var expected = '<p><a href="http://example.com">http://example.com</a></p>\n';
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
it('should preserve newlines when converting mixed paragraph text and autolinks', function (done) {
var fixture = [
'hello world',
'<http://example.com>'
].join('\n');
var actual = marked(fixture);
var expected = [
'<p>hello world',
'<a href="http://example.com">http://example.com</a></p>',
''
].join('\n');
it('should preserve newlines when converting mixed paragraph text and autolinks', function () {
var actual = remarked('hello world\n<http://example.com>');
var expected = '<p>hello world\n<a href="http://example.com">http://example.com</a></p>\n';
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -49,11 +38,10 @@ });

describe('auto_links', function () {
it('should convert auto_links', function (done) {
it('should convert auto_links', function () {
var testfile = 'auto_links';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -63,11 +51,10 @@ });

describe('case_insensitive_refs', function () {
it('should convert case_insensitive_refs', function (done) {
it('should convert case_insensitive_refs', function () {
var testfile = 'links_case_insensitive_refs';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -78,11 +65,10 @@ });

describe('double_link', function () {
it('should convert double_link', function (done) {
it('should convert double_link', function () {
var testfile = 'double_link';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -93,11 +79,10 @@ });

describe('links_inline_style', function () {
it('should convert links_inline_style', function (done) {
it('should convert links_inline_style', function () {
var testfile = 'links_inline_style';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -107,11 +92,10 @@ });

describe('links_reference_style', function () {
it('should convert links_reference_style', function (done) {
it('should convert links_reference_style', function () {
var testfile = 'links_reference_style';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -121,11 +105,10 @@ });

describe('links_shortcut_references', function () {
it('should convert links_shortcut_references', function (done) {
it('should convert links_shortcut_references', function () {
var testfile = 'links_shortcut_references';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -136,11 +119,10 @@ });

describe('nested_square_link', function () {
it('should convert nested_square_link', function (done) {
it('should convert nested_square_link', function () {
var testfile = 'nested_square_link';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -150,11 +132,10 @@ });

describe('not_a_link', function () {
it('should convert not_a_link', function (done) {
it('should convert not_a_link', function () {
var testfile = 'not_a_link';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -164,11 +145,10 @@ });

describe('literal_quotes_in_titles', function () {
it('should convert literal_quotes_in_titles', function (done) {
it('should convert literal_quotes_in_titles', function () {
var testfile = 'links_literal_quotes_in_titles';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -178,11 +158,10 @@ });

describe('when a link reference is in parentheses', function () {
it('should convert ref_paren', function (done) {
it('should convert ref_paren', function () {
var testfile = 'links_ref_paren';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -189,0 +168,0 @@ });

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -21,11 +23,10 @@ * lists

describe('hard_wrapped_paragraphs_with_list_like_lines', function () {
it('should convert hard_wrapped_paragraphs_with_list_like_lines', function (done) {
it('should convert hard_wrapped_paragraphs_with_list_like_lines', function () {
var testfile = 'hard_wrapped_paragraphs_with_list_like_lines.nogfm';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture, {gfm: false});
var actual = remarked(fixture, {gfm: false});
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -35,11 +36,10 @@ });

describe('loose_lists', function () {
it('should convert loose_lists', function (done) {
it('should convert loose_lists', function () {
var testfile = 'loose_lists';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -49,11 +49,10 @@ });

describe('list_item_text', function () {
it('should convert list_item_text', function (done) {
it('should convert list_item_text', function () {
var testfile = 'list_item_text';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -63,11 +62,10 @@ });

describe('ordered_and_unordered_lists', function () {
it('should convert ordered_and_unordered_lists', function (done) {
it('should convert ordered_and_unordered_lists', function () {
var testfile = 'ordered_and_unordered_lists';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -78,11 +76,10 @@ });

describe('tricky_list', function () {
it('should convert tricky_list', function (done) {
it('should convert tricky_list', function () {
var testfile = 'tricky_list';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});

@@ -93,13 +90,12 @@ });

describe('same_bullet', function () {
it('should convert same_bullet', function (done) {
it('should convert same_bullet', function () {
var testfile = 'same_bullet';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -22,8 +24,7 @@ * paragraphs

describe('when a simple string is passed', function () {
it('it should be wrapped in paragraph tags, ending with a newline', function (done) {
var actual = marked('foo');
it('it should be wrapped in paragraph tags, ending with a newline', function () {
var actual = remarked('foo');
expect(actual).to.deep.equal('<p>foo</p>\n');
done();
});
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -20,12 +22,11 @@ * smatypants

describe('smartypants', function () {
it('should convert text', function (done) {
it('should convert text', function () {
var testfile = 'smartypants_text';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture, {smartypants: true});
var actual = remarked(fixture, {smartypants: true});
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});

@@ -8,8 +8,10 @@ /**

const expect = require('chai').expect;
const marked = require('../');
const helper = require('./helpers/utils');
const normalize = helper.normalize;
'use strict';
var expect = require('chai').expect;
var remarked = require('../');
var helper = require('./helpers/utils');
var normalize = helper.stripSpaces;
/**

@@ -20,12 +22,11 @@ * Language tests

describe('amps_and_angles_encoding', function () {
it('should convert amps_and_angles_encoding', function (done) {
it('should convert amps_and_angles_encoding', function () {
var testfile = 'amps_and_angles_encoding';
var fixture = helper.readFile(testfile + '.md');
var actual = marked(fixture);
var actual = remarked(fixture);
helper.writeActual('extras', testfile, actual);
helper.writeActual(testfile, actual);
var expected = helper.readFile(testfile + '.html');
expect(normalize(actual)).to.equal(normalize(expected));
done();
});
});

@@ -8,9 +8,11 @@ /**

const expect = require('chai').expect;
const utils = require('../lib/utils/helpers');
'use strict';
var expect = require('chai').expect;
var utils = require('../lib/utils/helpers');
describe('utils', function () {
describe('merge', function () {
it('should merge objects', function (done) {
it('should merge objects', function () {
var fixture = {a: 'a', b: 'b', c: 'c'};

@@ -20,6 +22,5 @@

expect(actual).to.eql(fixture);
done();
});
it('should merge objects from left to right', function (done) {
it('should merge objects from left to right', function () {
var one = {a: 'a', b: 'b', c: 'c'};

@@ -30,6 +31,5 @@ var two = {a: 'b', b: 'c', c: 'd'};

expect(actual).to.eql(two);
done();
});
it('should merge objects from left to right', function (done) {
it('should merge objects from left to right', function () {
var one = {a: 'a', b: 'b', c: 'c'};

@@ -40,5 +40,4 @@ var two = {a: 'b', b: 'c', c: 'd'};

expect(actual).to.eql(two);
done();
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc