Skip to content

Instantly share code, notes, and snippets.

@MoOx

MoOx/index.js

Created Sep 11, 2017
Embed
What would you like to do?
requirebin sketch
var unified = require('unified');
var markdown = require('remark-parse');
var remark2rehype = require('remark-rehype');
var slug = require('rehype-slug');
var link = require('rehype-autolink-headings');
var raw = require('rehype-raw');
var stringify = require('rehype-stringify');
const input = `## Test
[link](href)
\`\`\`js
console.log(window)
\`\`\`
<button>Random Html</button>
<Button>Random react like stuff</Button>
`;
unified()
.use(markdown)
.use(remark2rehype, {allowDangerousHTML: true})
.use(slug)
.use(link)
.use(raw)
.use(stringify)
.processSync(input);
This file has been truncated, but you can view the full file.
setTimeout(function(){
;require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
var splitPath = function(filename) {
return splitPathRe.exec(filename).slice(1);
};
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.isAbsolute = function(path) {
return path.charAt(0) === '/';
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
};
// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function(path) {
var result = splitPath(path),
root = result[0],
dir = result[1];
if (!root && !dir) {
// No dirname whatsoever
return '.';
}
if (dir) {
// It has a dirname, strip trailing slash
dir = dir.substr(0, dir.length - 1);
}
return root + dir;
};
exports.basename = function(path, ext) {
var f = splitPath(path)[2];
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPath(path)[3];
};
function filter (xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
? function (str, start, len) { return str.substr(start, len) }
: function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
}
;
}).call(this,require('_process'))
},{"_process":2}],2:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],3:[function(require,module,exports){
'use strict';
module.exports = bail;
function bail(err) {
if (err) {
throw err;
}
}
},{}],4:[function(require,module,exports){
'use strict';
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
return Array.isArray(arr);
}
return toStr.call(arr) === '[object Array]';
};
var isPlainObject = function isPlainObject(obj) {
if (!obj || toStr.call(obj) !== '[object Object]') {
return false;
}
var hasOwnConstructor = hasOwn.call(obj, 'constructor');
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
// Not own constructor property must be Object
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for (key in obj) { /**/ }
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
var i = 1;
var length = arguments.length;
var deep = false;
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
target = {};
}
for (; i < length; ++i) {
options = arguments[i];
// Only deal with non-null/undefined values
if (options != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target !== copy) {
// Recurse if we're merging plain objects or arrays
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
}
}
// Return the modified object
return target;
};
},{}],5:[function(require,module,exports){
'use strict';
var toString = Object.prototype.toString;
module.exports = function (x) {
var prototype;
return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({}));
};
},{}],6:[function(require,module,exports){
'use strict';
/* Expose. */
module.exports = trough;
/* Methods. */
var slice = [].slice;
/* Create new middleware. */
function trough() {
var fns = [];
var middleware = {};
middleware.run = run;
middleware.use = use;
return middleware;
/* Run `fns`. Last argument must be
* a completion handler. */
function run() {
var index = -1;
var input = slice.call(arguments, 0, -1);
var done = arguments[arguments.length - 1];
if (typeof done !== 'function') {
throw new Error('Expected function as last argument, not ' + done);
}
next.apply(null, [null].concat(input));
/* Run the next `fn`, if any. */
function next(err) {
var fn = fns[++index];
var params = slice.call(arguments, 0);
var values = params.slice(1);
var length = input.length;
var pos = -1;
if (err) {
done(err);
return;
}
/* Copy non-nully input into values. */
while (++pos < length) {
if (values[pos] === null || values[pos] === undefined) {
values[pos] = input[pos];
}
}
input = values;
/* Next or done. */
if (fn) {
wrap(fn, next).apply(null, input);
} else {
done.apply(null, [null].concat(input));
}
}
}
/* Add `fn` to the list. */
function use(fn) {
if (typeof fn !== 'function') {
throw new Error('Expected `fn` to be a function, not ' + fn);
}
fns.push(fn);
return middleware;
}
}
/* Wrap `fn`. Can be sync or async; return a promise,
* receive a completion handler, return new values and
* errors. */
function wrap(fn, next) {
var invoked;
return wrapped;
function wrapped() {
var params = slice.call(arguments, 0);
var callback = fn.length > params.length;
var result;
if (callback) {
params.push(done);
}
try {
result = fn.apply(null, params);
} catch (err) {
/* Well, this is quite the pickle. `fn` received
* a callback and invoked it (thus continuing the
* pipeline), but later also threw an error.
* We’re not about to restart the pipeline again,
* so the only thing left to do is to throw the
* thing instea. */
if (callback && invoked) {
throw err;
}
return done(err);
}
if (!callback) {
if (result && typeof result.then === 'function') {
result.then(then, done);
} else if (result instanceof Error) {
done(result);
} else {
then(result);
}
}
}
/* Invoke `next`, only once. */
function done() {
if (!invoked) {
invoked = true;
next.apply(null, arguments);
}
}
/* Invoke `done` with one value.
* Tracks if an error is passed, too. */
function then(value) {
done(null, value);
}
}
},{}],7:[function(require,module,exports){
(function (process){
'use strict';
var path = require('path');
var replace = require('replace-ext');
var stringify = require('unist-util-stringify-position');
var buffer = require('is-buffer');
module.exports = VFile;
var own = {}.hasOwnProperty;
var proto = VFile.prototype;
proto.toString = toString;
proto.message = message;
proto.info = info;
proto.fail = fail;
/* Slight backwards compatibility. Remove in the future. */
proto.warn = message;
/* Order of setting (least specific to most), we need this because
* otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path
* is needed before a stem can be set. */
var order = [
'history',
'path',
'basename',
'stem',
'extname',
'dirname'
];
/* Construct a new file. */
function VFile(options) {
var prop;
var index;
var length;
if (!options) {
options = {};
} else if (typeof options === 'string' || buffer(options)) {
options = {contents: options};
} else if ('message' in options && 'messages' in options) {
return options;
}
if (!(this instanceof VFile)) {
return new VFile(options);
}
this.data = {};
this.messages = [];
this.history = [];
this.cwd = process.cwd();
/* Set path related properties in the correct order. */
index = -1;
length = order.length;
while (++index < length) {
prop = order[index];
if (own.call(options, prop)) {
this[prop] = options[prop];
}
}
/* Set non-path related properties. */
for (prop in options) {
if (order.indexOf(prop) === -1) {
this[prop] = options[prop];
}
}
}
/* Access full path (`~/index.min.js`). */
Object.defineProperty(proto, 'path', {
get: function () {
return this.history[this.history.length - 1];
},
set: function (path) {
assertNonEmpty(path, 'path');
if (path !== this.path) {
this.history.push(path);
}
}
});
/* Access parent path (`~`). */
Object.defineProperty(proto, 'dirname', {
get: function () {
return typeof this.path === 'string' ? path.dirname(this.path) : undefined;
},
set: function (dirname) {
assertPath(this.path, 'dirname');
this.path = path.join(dirname || '', this.basename);
}
});
/* Access basename (`index.min.js`). */
Object.defineProperty(proto, 'basename', {
get: function () {
return typeof this.path === 'string' ? path.basename(this.path) : undefined;
},
set: function (basename) {
assertNonEmpty(basename, 'basename');
assertPart(basename, 'basename');
this.path = path.join(this.dirname || '', basename);
}
});
/* Access extname (`.js`). */
Object.defineProperty(proto, 'extname', {
get: function () {
return typeof this.path === 'string' ? path.extname(this.path) : undefined;
},
set: function (extname) {
var ext = extname || '';
assertPart(ext, 'extname');
assertPath(this.path, 'extname');
if (ext) {
if (ext.charAt(0) !== '.') {
throw new Error('`extname` must start with `.`');
}
if (ext.indexOf('.', 1) !== -1) {
throw new Error('`extname` cannot contain multiple dots');
}
}
this.path = replace(this.path, ext);
}
});
/* Access stem (`index.min`). */
Object.defineProperty(proto, 'stem', {
get: function () {
return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined;
},
set: function (stem) {
assertNonEmpty(stem, 'stem');
assertPart(stem, 'stem');
this.path = path.join(this.dirname || '', stem + (this.extname || ''));
}
});
/* Get the value of the file. */
function toString(encoding) {
var value = this.contents || '';
return buffer(value) ? value.toString(encoding) : String(value);
}
/* Create a message with `reason` at `position`.
* When an error is passed in as `reason`, copies the stack. */
function message(reason, position, ruleId) {
var filePath = this.path;
var range = stringify(position) || '1:1';
var location;
var err;
location = {
start: {line: null, column: null},
end: {line: null, column: null}
};
if (position && position.position) {
position = position.position;
}
if (position) {
/* Location. */
if (position.start) {
location = position;
position = position.start;
} else {
/* Position. */
location.start = position;
}
}
err = new VMessage(reason.message || reason);
err.name = (filePath ? filePath + ':' : '') + range;
err.file = filePath || '';
err.reason = reason.message || reason;
err.line = position ? position.line : null;
err.column = position ? position.column : null;
err.location = location;
err.ruleId = ruleId || null;
err.source = null;
err.fatal = false;
if (reason.stack) {
err.stack = reason.stack;
}
this.messages.push(err);
return err;
}
/* Fail. Creates a vmessage, associates it with the file,
* and throws it. */
function fail() {
var message = this.message.apply(this, arguments);
message.fatal = true;
throw message;
}
/* Info. Creates a vmessage, associates it with the file,
* and marks the fatality as null. */
function info() {
var message = this.message.apply(this, arguments);
message.fatal = null;
return message;
}
/* Inherit from `Error#`. */
function VMessagePrototype() {}
VMessagePrototype.prototype = Error.prototype;
VMessage.prototype = new VMessagePrototype();
/* Message properties. */
proto = VMessage.prototype;
proto.file = '';
proto.name = '';
proto.reason = '';
proto.message = '';
proto.stack = '';
proto.fatal = null;
proto.column = null;
proto.line = null;
/* Construct a new file message.
*
* Note: We cannot invoke `Error` on the created context,
* as that adds readonly `line` and `column` attributes on
* Safari 9, thus throwing and failing the data. */
function VMessage(reason) {
this.message = reason;
}
/* Assert that `part` is not a path (i.e., does
* not contain `path.sep`). */
function assertPart(part, name) {
if (part.indexOf(path.sep) !== -1) {
throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`');
}
}
/* Assert that `part` is not empty. */
function assertNonEmpty(part, name) {
if (!part) {
throw new Error('`' + name + '` cannot be empty');
}
}
/* Assert `path` exists. */
function assertPath(path, name) {
if (!path) {
throw new Error('Setting `' + name + '` requires `path` to be set too');
}
}
}).call(this,require('_process'))
},{"_process":2,"is-buffer":8,"path":1,"replace-ext":9,"unist-util-stringify-position":10}],8:[function(require,module,exports){
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
// The _isBuffer check is for Safari 5-7 support, because it's missing
// Object.prototype.constructor. Remove this eventually
module.exports = function (obj) {
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
}
function isBuffer (obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
// For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
}
},{}],9:[function(require,module,exports){
'use strict';
var path = require('path');
function replaceExt(npath, ext) {
if (typeof npath !== 'string') {
return npath;
}
if (npath.length === 0) {
return npath;
}
var nFileName = path.basename(npath, path.extname(npath)) + ext;
return path.join(path.dirname(npath), nFileName);
}
module.exports = replaceExt;
},{"path":1}],10:[function(require,module,exports){
'use strict';
var own = {}.hasOwnProperty;
module.exports = stringify;
function stringify(value) {
/* Nothing. */
if (!value || typeof value !== 'object') {
return null;
}
/* Node. */
if (own.call(value, 'position') || own.call(value, 'type')) {
return location(value.position);
}
/* Location. */
if (own.call(value, 'start') || own.call(value, 'end')) {
return location(value);
}
/* Position. */
if (own.call(value, 'line') || own.call(value, 'column')) {
return position(value);
}
/* ? */
return null;
}
function position(pos) {
if (!pos || typeof pos !== 'object') {
pos = {};
}
return index(pos.line) + ':' + index(pos.column);
}
function location(loc) {
if (!loc || typeof loc !== 'object') {
loc = {};
}
return position(loc.start) + '-' + position(loc.end);
}
function index(value) {
return value && typeof value === 'number' ? value : 1;
}
},{}],11:[function(require,module,exports){
module.exports = function isFunction (fn) {
return Object.prototype.toString.call(fn) === '[object Function]'
}
},{}],12:[function(require,module,exports){
var toString = Object.prototype.toString
module.exports = isString
function isString(obj) {
return toString.call(obj) === "[object String]"
}
},{}],"unified":[function(require,module,exports){
'use strict';
/* Dependencies. */
var extend = require('extend');
var bail = require('bail');
var vfile = require('vfile');
var trough = require('trough');
var string = require('x-is-string');
var func = require('x-is-function');
var plain = require('is-plain-obj');
/* Expose a frozen processor. */
module.exports = unified().freeze();
var slice = [].slice;
var own = {}.hasOwnProperty;
/* Process pipeline. */
var pipeline = trough().use(pipelineParse).use(pipelineRun).use(pipelineStringify);
function pipelineParse(p, ctx) {
ctx.tree = p.parse(ctx.file);
}
function pipelineRun(p, ctx, next) {
p.run(ctx.tree, ctx.file, done);
function done(err, tree, file) {
if (err) {
next(err);
} else {
ctx.tree = tree;
ctx.file = file;
next();
}
}
}
function pipelineStringify(p, ctx) {
ctx.file.contents = p.stringify(ctx.tree, ctx.file);
}
/* Function to create the first processor. */
function unified() {
var attachers = [];
var transformers = trough();
var namespace = {};
var frozen = false;
var freezeIndex = -1;
/* Data management. */
processor.data = data;
/* Lock. */
processor.freeze = freeze;
/* Plug-ins. */
processor.attachers = attachers;
processor.use = use;
/* API. */
processor.parse = parse;
processor.stringify = stringify;
processor.run = run;
processor.runSync = runSync;
processor.process = process;
processor.processSync = processSync;
/* Expose. */
return processor;
/* Create a new processor based on the processor
* in the current scope. */
function processor() {
var destination = unified();
var length = attachers.length;
var index = -1;
while (++index < length) {
destination.use.apply(null, attachers[index]);
}
destination.data(extend(true, {}, namespace));
return destination;
}
/* Freeze: used to signal a processor that has finished
* configuration.
*
* For example, take unified itself. It’s frozen.
* Plug-ins should not be added to it. Rather, it should
* be extended, by invoking it, before modifying it.
*
* In essence, always invoke this when exporting a
* processor. */
function freeze() {
var values;
var plugin;
var options;
var transformer;
if (frozen) {
return processor;
}
while (++freezeIndex < attachers.length) {
values = attachers[freezeIndex];
plugin = values[0];
options = values[1];
transformer = null;
if (options === false) {
continue;
}
if (options === true) {
values[1] = undefined;
}
transformer = plugin.apply(processor, values.slice(1));
if (func(transformer)) {
transformers.use(transformer);
}
}
frozen = true;
freezeIndex = Infinity;
return processor;
}
/* Data management.
* Getter / setter for processor-specific informtion. */
function data(key, value) {
if (string(key)) {
/* Set `key`. */
if (arguments.length === 2) {
assertUnfrozen('data', frozen);
namespace[key] = value;
return processor;
}
/* Get `key`. */
return (own.call(namespace, key) && namespace[key]) || null;
}
/* Set space. */
if (key) {
assertUnfrozen('data', frozen);
namespace = key;
return processor;
}
/* Get space. */
return namespace;
}
/* Plug-in management.
*
* Pass it:
* * an attacher and options,
* * a preset,
* * a list of presets, attachers, and arguments (list
* of attachers and options). */
function use(value) {
var settings;
assertUnfrozen('use', frozen);
if (value === null || value === undefined) {
/* Empty */
} else if (func(value)) {
addPlugin.apply(null, arguments);
} else if (typeof value === 'object') {
if ('length' in value) {
addList(value);
} else {
addPreset(value);
}
} else {
throw new Error('Expected usable value, not `' + value + '`');
}
if (settings) {
namespace.settings = extend(namespace.settings || {}, settings);
}
return processor;
function addPreset(result) {
addList(result.plugins);
if (result.settings) {
settings = extend(settings || {}, result.settings);
}
}
function add(value) {
if (func(value)) {
addPlugin(value);
} else if (typeof value === 'object') {
if ('length' in value) {
addPlugin.apply(null, value);
} else {
addPreset(value);
}
} else {
throw new Error('Expected usable value, not `' + value + '`');
}
}
function addList(plugins) {
var length;
var index;
if (plugins === null || plugins === undefined) {
/* Empty */
} else if (typeof plugins === 'object' && 'length' in plugins) {
length = plugins.length;
index = -1;
while (++index < length) {
add(plugins[index]);
}
} else {
throw new Error('Expected a list of plugins, not `' + plugins + '`');
}
}
function addPlugin(plugin, value) {
var entry = find(plugin);
if (entry) {
if (plain(entry[1]) && plain(value)) {
value = extend(entry[1], value);
}
entry[1] = value;
} else {
attachers.push(slice.call(arguments));
}
}
}
function find(plugin) {
var length = attachers.length;
var index = -1;
var entry;
while (++index < length) {
entry = attachers[index];
if (entry[0] === plugin) {
return entry;
}
}
}
/* Parse a file (in string or VFile representation)
* into a Unist node using the `Parser` on the
* processor. */
function parse(doc) {
var file = vfile(doc);
var Parser;
freeze();
Parser = processor.Parser;
assertParser('parse', Parser);
if (newable(Parser)) {
return new Parser(String(file), file).parse();
}
return Parser(String(file), file); // eslint-disable-line new-cap
}
/* Run transforms on a Unist node representation of a file
* (in string or VFile representation), async. */
function run(node, file, cb) {
assertNode(node);
freeze();
if (!cb && func(file)) {
cb = file;
file = null;
}
if (!cb) {
return new Promise(executor);
}
executor(null, cb);
function executor(resolve, reject) {
transformers.run(node, vfile(file), done);
function done(err, tree, file) {
tree = tree || node;
if (err) {
reject(err);
} else if (resolve) {
resolve(tree);
} else {
cb(null, tree, file);
}
}
}
}
/* Run transforms on a Unist node representation of a file
* (in string or VFile representation), sync. */
function runSync(node, file) {
var complete = false;
var result;
run(node, file, done);
assertDone('runSync', 'run', complete);
return result;
function done(err, tree) {
complete = true;
bail(err);
result = tree;
}
}
/* Stringify a Unist node representation of a file
* (in string or VFile representation) into a string
* using the `Compiler` on the processor. */
function stringify(node, doc) {
var file = vfile(doc);
var Compiler;
freeze();
Compiler = processor.Compiler;
assertCompiler('stringify', Compiler);
assertNode(node);
if (newable(Compiler)) {
return new Compiler(node, file).compile();
}
return Compiler(node, file); // eslint-disable-line new-cap
}
/* Parse a file (in string or VFile representation)
* into a Unist node using the `Parser` on the processor,
* then run transforms on that node, and compile the
* resulting node using the `Compiler` on the processor,
* and store that result on the VFile. */
function process(doc, cb) {
freeze();
assertParser('process', processor.Parser);
assertCompiler('process', processor.Compiler);
if (!cb) {
return new Promise(executor);
}
executor(null, cb);
function executor(resolve, reject) {
var file = vfile(doc);
pipeline.run(processor, {file: file}, done);
function done(err) {
if (err) {
reject(err);
} else if (resolve) {
resolve(file);
} else {
cb(null, file);
}
}
}
}
/* Process the given document (in string or VFile
* representation), sync. */
function processSync(doc) {
var complete = false;
var file;
freeze();
assertParser('processSync', processor.Parser);
assertCompiler('processSync', processor.Compiler);
file = vfile(doc);
process(file, done);
assertDone('processSync', 'process', complete);
return file;
function done(err) {
complete = true;
bail(err);
}
}
}
/* Check if `func` is a constructor. */
function newable(value) {
return func(value) && keys(value.prototype);
}
/* Check if `value` is an object with keys. */
function keys(value) {
var key;
for (key in value) {
return true;
}
return false;
}
/* Assert a parser is available. */
function assertParser(name, Parser) {
if (!func(Parser)) {
throw new Error('Cannot `' + name + '` without `Parser`');
}
}
/* Assert a compiler is available. */
function assertCompiler(name, Compiler) {
if (!func(Compiler)) {
throw new Error('Cannot `' + name + '` without `Compiler`');
}
}
/* Assert the processor is not frozen. */
function assertUnfrozen(name, frozen) {
if (frozen) {
throw new Error(
'Cannot invoke `' + name + '` on a frozen processor.\n' +
'Create a new processor first, by invoking it: ' +
'use `processor()` instead of `processor`.'
);
}
}
/* Assert `node` is a Unist node. */
function assertNode(node) {
if (!node || !string(node.type)) {
throw new Error('Expected node, got `' + node + '`');
}
}
/* Assert that `complete` is `true`. */
function assertDone(name, asyncName, complete) {
if (!complete) {
throw new Error('`' + name + '` finished async. Use `' + asyncName + '` instead');
}
}
},{"bail":3,"extend":4,"is-plain-obj":5,"trough":6,"vfile":7,"x-is-function":11,"x-is-string":12}]},{},[])
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2hvbWUvYWRtaW4vYnJvd3NlcmlmeS1jZG4vbm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2Jyb3dzZXItcGFjay9fcHJlbHVkZS5qcyIsI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J3VzZSBgcHJvY2Vzc29yKClgIGluc3RlYWQgb2YgYHByb2Nlc3NvcmAuJ1xuICAgICk7XG4gIH1cbn1cblxuLyogQXNzZXJ0IGBub2RlYCBpcyBhIFVuaXN0IG5vZGUuICovXG5mdW5jdGlvbiBhc3NlcnROb2RlKG5vZGUpIHtcbiAgaWYgKCFub2RlIHx8ICFzdHJpbmcobm9kZS50eXBlKSkge1xuICAgIHRocm93IG5ldyBFcnJvcignRXhwZWN0ZWQgbm9kZSwgZ290IGAnICsgbm9kZSArICdgJyk7XG4gIH1cbn1cblxuLyogQXNzZXJ0IHRoYXQgYGNvbXBsZXRlYCBpcyBgdHJ1ZWAuICovXG5mdW5jdGlvbiBhc3NlcnREb25lKG5hbWUsIGFzeW5jTmFtZSwgY29tcGxldGUpIHtcbiAgaWYgKCFjb21wbGV0ZSkge1xuICAgIHRocm93IG5ldyBFcnJvcignYCcgKyBuYW1lICsgJ2AgZmluaXNoZWQgYXN5bmMuIFVzZSBgJyArIGFzeW5jTmFtZSArICdgIGluc3RlYWQnKTtcbiAgfVxufVxuIl19
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports=[
"address",
"article",
"aside",
"base",
"basefont",
"blockquote",
"body",
"caption",
"center",
"col",
"colgroup",
"dd",
"details",
"dialog",
"dir",
"div",
"dl",
"dt",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"frame",
"frameset",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hgroup",
"hr",
"html",
"iframe",
"legend",
"li",
"link",
"main",
"menu",
"menuitem",
"meta",
"nav",
"noframes",
"ol",
"optgroup",
"option",
"p",
"param",
"pre",
"section",
"source",
"title",
"summary",
"table",
"tbody",
"td",
"tfoot",
"th",
"thead",
"title",
"tr",
"track",
"ul"
]
},{}],2:[function(require,module,exports){
'use strict';
var entities = require('parse-entities');
module.exports = factory;
/* Factory to create an entity decoder. */
function factory(ctx) {
decoder.raw = decodeRaw;
return decoder;
/* Normalize `position` to add an `indent`. */
function normalize(position) {
var offsets = ctx.offset;
var line = position.line;
var result = [];
while (++line) {
if (!(line in offsets)) {
break;
}
result.push((offsets[line] || 0) + 1);
}
return {
start: position,
indent: result
};
}
/* Handle a warning.
* See https://github.com/wooorm/parse-entities
* for the warnings. */
function handleWarning(reason, position, code) {
if (code === 3) {
return;
}
ctx.file.message(reason, position);
}
/* Decode `value` (at `position`) into text-nodes. */
function decoder(value, position, handler) {
entities(value, {
position: normalize(position),
warning: handleWarning,
text: handler,
reference: handler,
textContext: ctx,
referenceContext: ctx
});
}
/* Decode `value` (at `position`) into a string. */
function decodeRaw(value, position) {
return entities(value, {
position: normalize(position),
warning: handleWarning
});
}
}
},{"parse-entities":54}],3:[function(require,module,exports){
'use strict';
module.exports = {
position: true,
gfm: true,
commonmark: false,
footnotes: false,
pedantic: false,
blocks: require('./block-elements.json')
};
},{"./block-elements.json":1}],4:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
var index = value.indexOf('\n', fromIndex);
while (index > fromIndex) {
if (value.charAt(index - 1) !== ' ') {
break;
}
index--;
}
return index;
}
},{}],5:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
return value.indexOf('`', fromIndex);
}
},{}],6:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
return value.indexOf('~~', fromIndex);
}
},{}],7:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
var asterisk = value.indexOf('*', fromIndex);
var underscore = value.indexOf('_', fromIndex);
if (underscore === -1) {
return asterisk;
}
if (asterisk === -1) {
return underscore;
}
return underscore < asterisk ? underscore : asterisk;
}
},{}],8:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
return value.indexOf('\\', fromIndex);
}
},{}],9:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
var link = value.indexOf('[', fromIndex);
var image = value.indexOf('![', fromIndex);
if (image === -1) {
return link;
}
/* Link can never be `-1` if an image is found, so we don’t need
* to check for that :) */
return link < image ? link : image;
}
},{}],10:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
var asterisk = value.indexOf('**', fromIndex);
var underscore = value.indexOf('__', fromIndex);
if (underscore === -1) {
return asterisk;
}
if (asterisk === -1) {
return underscore;
}
return underscore < asterisk ? underscore : asterisk;
}
},{}],11:[function(require,module,exports){
'use strict';
module.exports = locate;
function locate(value, fromIndex) {
return value.indexOf('<', fromIndex);
}
},{}],12:[function(require,module,exports){
'use strict';
module.exports = locate;
var PROTOCOLS = ['https://', 'http://', 'mailto:'];
function locate(value, fromIndex) {
var length = PROTOCOLS.length;
var index = -1;
var min = -1;
var position;
if (!this.options.gfm) {
return -1;
}
while (++index < length) {
position = value.indexOf(PROTOCOLS[index], fromIndex);
if (position !== -1 && (position < min || min === -1)) {
min = position;
}
}
return min;
}
},{}],13:[function(require,module,exports){
'use strict';
var xtend = require('xtend');
var removePosition = require('unist-util-remove-position');
module.exports = parse;
var C_NEWLINE = '\n';
var EXPRESSION_LINE_BREAKS = /\r\n|\r/g;
/* Parse the bound file. */
function parse() {
var self = this;
var value = String(self.file);
var start = {line: 1, column: 1, offset: 0};
var content = xtend(start);
var node;
/* Clean non-unix newlines: `\r\n` and `\r` are all
* changed to `\n`. This should not affect positional
* information. */
value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);
if (value.charCodeAt(0) === 0xFEFF) {
value = value.slice(1);
content.column++;
content.offset++;
}
node = {
type: 'root',
children: self.tokenizeBlock(value, content),
position: {
start: start,
end: self.eof || xtend(start)
}
};
if (!self.options.position) {
removePosition(node, true);
}
return node;
}
},{"unist-util-remove-position":66,"xtend":69}],14:[function(require,module,exports){
'use strict';
var xtend = require('xtend');
var toggle = require('state-toggle');
var vfileLocation = require('vfile-location');
var unescape = require('./unescape');
var decode = require('./decode');
var tokenizer = require('./tokenizer');
module.exports = Parser;
function Parser(doc, file) {
this.file = file;
this.offset = {};
this.options = xtend(this.options);
this.setOptions({});
this.inList = false;
this.inBlock = false;
this.inLink = false;
this.atStart = true;
this.toOffset = vfileLocation(file).toOffset;
this.unescape = unescape(this, 'escape');
this.decode = decode(this);
}
var proto = Parser.prototype;
/* Expose core. */
proto.setOptions = require('./set-options');
proto.parse = require('./parse');
/* Expose `defaults`. */
proto.options = require('./defaults');
/* Enter and exit helpers. */
proto.exitStart = toggle('atStart', true);
proto.enterList = toggle('inList', false);
proto.enterLink = toggle('inLink', false);
proto.enterBlock = toggle('inBlock', false);
/* Nodes that can interupt a paragraph:
*
* ```markdown
* A paragraph, followed by a thematic break.
* ___
* ```
*
* In the above example, the thematic break “interupts”
* the paragraph. */
proto.interruptParagraph = [
['thematicBreak'],
['atxHeading'],
['fencedCode'],
['blockquote'],
['html'],
['setextHeading', {commonmark: false}],
['definition', {commonmark: false}],
['footnote', {commonmark: false}]
];
/* Nodes that can interupt a list:
*
* ```markdown
* - One
* ___
* ```
*
* In the above example, the thematic break “interupts”
* the list. */
proto.interruptList = [
['fencedCode', {pedantic: false}],
['thematicBreak', {pedantic: false}],
['definition', {commonmark: false}],
['footnote', {commonmark: false}]
];
/* Nodes that can interupt a blockquote:
*
* ```markdown
* > A paragraph.
* ___
* ```
*
* In the above example, the thematic break “interupts”
* the blockquote. */
proto.interruptBlockquote = [
['indentedCode', {commonmark: true}],
['fencedCode', {commonmark: true}],
['atxHeading', {commonmark: true}],
['setextHeading', {commonmark: true}],
['thematicBreak', {commonmark: true}],
['html', {commonmark: true}],
['list', {commonmark: true}],
['definition', {commonmark: false}],
['footnote', {commonmark: false}]
];
/* Handlers. */
proto.blockTokenizers = {
newline: require('./tokenize/newline'),
indentedCode: require('./tokenize/code-indented'),
fencedCode: require('./tokenize/code-fenced'),
blockquote: require('./tokenize/blockquote'),
atxHeading: require('./tokenize/heading-atx'),
thematicBreak: require('./tokenize/thematic-break'),
list: require('./tokenize/list'),
setextHeading: require('./tokenize/heading-setext'),
html: require('./tokenize/html-block'),
footnote: require('./tokenize/footnote-definition'),
definition: require('./tokenize/definition'),
table: require('./tokenize/table'),
paragraph: require('./tokenize/paragraph')
};
proto.inlineTokenizers = {
escape: require('./tokenize/escape'),
autoLink: require('./tokenize/auto-link'),
url: require('./tokenize/url'),
html: require('./tokenize/html-inline'),
link: require('./tokenize/link'),
reference: require('./tokenize/reference'),
strong: require('./tokenize/strong'),
emphasis: require('./tokenize/emphasis'),
deletion: require('./tokenize/delete'),
code: require('./tokenize/code-inline'),
break: require('./tokenize/break'),
text: require('./tokenize/text')
};
/* Expose precedence. */
proto.blockMethods = keys(proto.blockTokenizers);
proto.inlineMethods = keys(proto.inlineTokenizers);
/* Tokenizers. */
proto.tokenizeBlock = tokenizer('block');
proto.tokenizeInline = tokenizer('inline');
proto.tokenizeFactory = tokenizer;
/* Get all keys in `value`. */
function keys(value) {
var result = [];
var key;
for (key in value) {
result.push(key);
}
return result;
}
},{"./decode":2,"./defaults":3,"./parse":13,"./set-options":15,"./tokenize/auto-link":16,"./tokenize/blockquote":17,"./tokenize/break":18,"./tokenize/code-fenced":19,"./tokenize/code-indented":20,"./tokenize/code-inline":21,"./tokenize/definition":22,"./tokenize/delete":23,"./tokenize/emphasis":24,"./tokenize/escape":25,"./tokenize/footnote-definition":26,"./tokenize/heading-atx":27,"./tokenize/heading-setext":28,"./tokenize/html-block":29,"./tokenize/html-inline":30,"./tokenize/link":31,"./tokenize/list":32,"./tokenize/newline":33,"./tokenize/paragraph":34,"./tokenize/reference":35,"./tokenize/strong":36,"./tokenize/table":37,"./tokenize/text":38,"./tokenize/thematic-break":39,"./tokenize/url":40,"./tokenizer":41,"./unescape":42,"state-toggle":61,"vfile-location":68,"xtend":69}],15:[function(require,module,exports){
'use strict';
var xtend = require('xtend');
var escapes = require('markdown-escapes');
var defaults = require('./defaults');
module.exports = setOptions;
function setOptions(options) {
var self = this;
var current = self.options;
var key;
var value;
if (options == null) {
options = {};
} else if (typeof options === 'object') {
options = xtend(options);
} else {
throw new Error(
'Invalid value `' + options + '` ' +
'for setting `options`'
);
}
for (key in defaults) {
value = options[key];
if (value == null) {
value = current[key];
}
if (
(key !== 'blocks' && typeof value !== 'boolean') ||
(key === 'blocks' && typeof value !== 'object')
) {
throw new Error('Invalid value `' + value + '` for setting `options.' + key + '`');
}
options[key] = value;
}
self.options = options;
self.escape = escapes(options);
return self;
}
},{"./defaults":3,"markdown-escapes":53,"xtend":69}],16:[function(require,module,exports){
'use strict';
var whitespace = require('is-whitespace-character');
var decode = require('parse-entities');
var locate = require('../locate/tag');
module.exports = autoLink;
autoLink.locator = locate;
autoLink.notInLink = true;
var C_LT = '<';
var C_GT = '>';
var C_AT_SIGN = '@';
var C_SLASH = '/';
var MAILTO = 'mailto:';
var MAILTO_LENGTH = MAILTO.length;
/* Tokenise a link. */
function autoLink(eat, value, silent) {
var self;
var subvalue;
var length;
var index;
var queue;
var character;
var hasAtCharacter;
var link;
var now;
var content;
var tokenize;
var exit;
if (value.charAt(0) !== C_LT) {
return;
}
self = this;
subvalue = '';
length = value.length;
index = 0;
queue = '';
hasAtCharacter = false;
link = '';
index++;
subvalue = C_LT;
while (index < length) {
character = value.charAt(index);
if (
whitespace(character) ||
character === C_GT ||
character === C_AT_SIGN ||
(character === ':' && value.charAt(index + 1) === C_SLASH)
) {
break;
}
queue += character;
index++;
}
if (!queue) {
return;
}
link += queue;
queue = '';
character = value.charAt(index);
link += character;
index++;
if (character === C_AT_SIGN) {
hasAtCharacter = true;
} else {
if (
character !== ':' ||
value.charAt(index + 1) !== C_SLASH
) {
return;
}
link += C_SLASH;
index++;
}
while (index < length) {
character = value.charAt(index);
if (whitespace(character) || character === C_GT) {
break;
}
queue += character;
index++;
}
character = value.charAt(index);
if (!queue || character !== C_GT) {
return;
}
/* istanbul ignore if - never used (yet) */
if (silent) {
return true;
}
link += queue;
content = link;
subvalue += link + character;
now = eat.now();
now.column++;
now.offset++;
if (hasAtCharacter) {
if (link.slice(0, MAILTO_LENGTH).toLowerCase() === MAILTO) {
content = content.substr(MAILTO_LENGTH);
now.column += MAILTO_LENGTH;
now.offset += MAILTO_LENGTH;
} else {
link = MAILTO + link;
}
}
/* Temporarily remove support for escapes in autolinks. */
tokenize = self.inlineTokenizers.escape;
self.inlineTokenizers.escape = null;
exit = self.enterLink();
content = self.tokenizeInline(content, now);
self.inlineTokenizers.escape = tokenize;
exit();
return eat(subvalue)({
type: 'link',
title: null,
url: decode(link),
children: content
});
}
},{"../locate/tag":11,"is-whitespace-character":51,"parse-entities":54}],17:[function(require,module,exports){
'use strict';
var trim = require('trim');
var interrupt = require('../util/interrupt');
module.exports = blockquote;
var C_NEWLINE = '\n';
var C_TAB = '\t';
var C_SPACE = ' ';
var C_GT = '>';
/* Tokenise a blockquote. */
function blockquote(eat, value, silent) {
var self = this;
var offsets = self.offset;
var tokenizers = self.blockTokenizers;
var interruptors = self.interruptBlockquote;
var now = eat.now();
var currentLine = now.line;
var length = value.length;
var values = [];
var contents = [];
var indents = [];
var add;
var index = 0;
var character;
var rest;
var nextIndex;
var content;
var line;
var startIndex;
var prefixed;
var exit;
while (index < length) {
character = value.charAt(index);
if (character !== C_SPACE && character !== C_TAB) {
break;
}
index++;
}
if (value.charAt(index) !== C_GT) {
return;
}
if (silent) {
return true;
}
index = 0;
while (index < length) {
nextIndex = value.indexOf(C_NEWLINE, index);
startIndex = index;
prefixed = false;
if (nextIndex === -1) {
nextIndex = length;
}
while (index < length) {
character = value.charAt(index);
if (character !== C_SPACE && character !== C_TAB) {
break;
}
index++;
}
if (value.charAt(index) === C_GT) {
index++;
prefixed = true;
if (value.charAt(index) === C_SPACE) {
index++;
}
} else {
index = startIndex;
}
content = value.slice(index, nextIndex);
if (!prefixed && !trim(content)) {
index = startIndex;
break;
}
if (!prefixed) {
rest = value.slice(index);
/* Check if the following code contains a possible
* block. */
if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) {
break;
}
}
line = startIndex === index ? content : value.slice(startIndex, nextIndex);
indents.push(index - startIndex);
values.push(line);
contents.push(content);
index = nextIndex + 1;
}
index = -1;
length = indents.length;
add = eat(values.join(C_NEWLINE));
while (++index < length) {
offsets[currentLine] = (offsets[currentLine] || 0) + indents[index];
currentLine++;
}
exit = self.enterBlock();
contents = self.tokenizeBlock(contents.join(C_NEWLINE), now);
exit();
return add({
type: 'blockquote',
children: contents
});
}
},{"../util/interrupt":45,"trim":63}],18:[function(require,module,exports){
'use strict';
var locate = require('../locate/break');
module.exports = hardBreak;
hardBreak.locator = locate;
var MIN_BREAK_LENGTH = 2;
function hardBreak(eat, value, silent) {
var length = value.length;
var index = -1;
var queue = '';
var character;
while (++index < length) {
character = value.charAt(index);
if (character === '\n') {
if (index < MIN_BREAK_LENGTH) {
return;
}
/* istanbul ignore if - never used (yet) */
if (silent) {
return true;
}
queue += character;
return eat(queue)({type: 'break'});
}
if (character !== ' ') {
return;
}
queue += character;
}
}
},{"../locate/break":4}],19:[function(require,module,exports){
'use strict';
var trim = require('trim-trailing-lines');
module.exports = fencedCode;
var C_NEWLINE = '\n';
var C_TAB = '\t';
var C_SPACE = ' ';
var C_TILDE = '~';
var C_TICK = '`';
var MIN_FENCE_COUNT = 3;
var CODE_INDENT_COUNT = 4;
function fencedCode(eat, value, silent) {
var self = this;
var settings = self.options;
var length = value.length + 1;
var index = 0;
var subvalue = '';
var fenceCount;
var marker;
var character;
var flag;
var queue;
var content;
var exdentedContent;
var closing;
var exdentedClosing;
var indent;
var now;
if (!settings.gfm) {
return;
}
/* Eat initial spacing. */
while (index < length) {
character = value.charAt(index);
if (character !== C_SPACE && character !== C_TAB) {
break;
}
subvalue += character;
index++;
}
indent = index;
/* Eat the fence. */
character = value.charAt(index);
if (character !== C_TILDE && character !== C_TICK) {
return;
}
index++;
marker = character;
fenceCount = 1;
subvalue += character;
while (index < length) {
character = value.charAt(index);
if (character !== marker) {
break;
}
subvalue += character;
fenceCount++;
index++;
}
if (fenceCount < MIN_FENCE_COUNT) {
return;
}
/* Eat spacing before flag. */
while (index < length) {
character = value.charAt(index);
if (character !== C_SPACE && character !== C_TAB) {
break;
}
subvalue += character;
index++;
}
/* Eat flag. */
flag = '';
queue = '';
while (index < length) {
character = value.charAt(index);
if (
character === C_NEWLINE ||
character === C_TILDE ||
character === C_TICK
) {
break;
}
if (character === C_SPACE || character === C_TAB) {
queue += character;
} else {
flag += queue + character;
queue = '';
}
index++;
}
character = value.charAt(index);
if (character && character !== C_NEWLINE) {
return;
}
if (silent) {
return true;
}
now = eat.now();
now.column += subvalue.length;
now.offset += subvalue.length;
subvalue += flag;
flag = self.decode.raw(self.unescape(flag), now);
if (queue) {
subvalue += queue;
}
queue = '';
closing = '';
exdentedClosing = '';
content = '';
exdentedContent = '';
/* Eat content. */
while (index < length) {
character = value.charAt(index);
content += closing;
exdentedContent += exdentedClosing;
closing = '';
exdentedClosing = '';
if (character !== C_NEWLINE) {
content += character;
exdentedClosing += character;
index++;
continue;
}
/* Add the newline to `subvalue` if its the first
* character. Otherwise, add it to the `closing`
* queue. */
if (content) {
closing += character;
exdentedClosing += character;
} else {
subvalue += character;
}
queue = '';
index++;
while (index < length) {
character = value.charAt(index);
if (character !== C_SPACE) {
break;
}
queue += character;
index++;
}
closing += queue;
exdentedClosing += queue.slice(indent);
if (queue.length >= CODE_INDENT_COUNT) {
continue;
}
queue = '';
while (index < length) {
character = value.charAt(index);
if (character !== marker) {
break;
}
queue += character;
index++;
}
closing += queue;
exdentedClosing += queue;
if (queue.length < fenceCount) {
continue;
}
queue = '';
while (index < length) {
character = value.charAt(index);
if (character !== C_SPACE && character !== C_TAB) {
break;
}
closing += character;
exdentedClosing += character;
index++;
}
if (!character || character === C_NEWLINE) {
break;
}
}
subvalue += content + closing;
return eat(subvalue)({
type: 'code',
lang: flag || null,
value: trim(exdentedContent)
});
}
},{"trim-trailing-lines":62}],20:[function(require,module,exports){
'use strict';
var repeat = require('repeat-string');
var trim = require('trim-trailing-lines');
module.exports = indentedCode;
var C_NEWLINE = '\n';
var C_TAB = '\t';