Skip to content

Commit

Permalink
Browser files rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Feb 16, 2017
1 parent c9199b5 commit b670878
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 25 deletions.
67 changes: 47 additions & 20 deletions dist/markdown-it.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! markdown-it 8.2.2 https://github.com//markdown-it/markdown-it @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownit = f()}})(function(){var define,module,exports;return (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){
/*! markdown-it 8.3.0 https://github.com//markdown-it/markdown-it @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownit = f()}})(function(){var define,module,exports;return (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){
// HTML5 entities map: { name -> utf16string }
//
'use strict';
Expand Down Expand Up @@ -1101,6 +1101,10 @@ MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
* and then pass updated object to renderer.
**/
MarkdownIt.prototype.parse = function (src, env) {
if (typeof src !== 'string') {
throw new Error('Input data should be a String');
}

var state = new this.core.State(src, this, env);

this.core.process(state);
Expand Down Expand Up @@ -2621,7 +2625,21 @@ module.exports = function blockquote(state, startLine, endLine, silent) {
break;
}
}
if (terminate) { break; }

if (terminate) {
if (oldIndent !== 0) {
// state.blkIndent was non-zero, we now set it to zero,
// so we need to re-calculate all offsets to appear as
// if indent wasn't changed
oldBMarks.push(state.bMarks[nextLine]);
oldBSCount.push(state.bsCount[nextLine]);
oldTShift.push(state.tShift[nextLine]);
oldSCount.push(state.sCount[nextLine]);
state.sCount[nextLine] -= oldIndent;
}

break;
}

oldBMarks.push(state.bMarks[nextLine]);
oldBSCount.push(state.bsCount[nextLine]);
Expand Down Expand Up @@ -3931,13 +3949,16 @@ module.exports = function table(state, startLine, endLine, silent) {
var ch, lineText, pos, i, nextLine, columns, columnCount, token,
aligns, t, tableLines, tbodyLines;

// should have at least three lines
// should have at least two lines
if (startLine + 2 > endLine) { return false; }

nextLine = startLine + 1;

if (state.sCount[nextLine] < state.blkIndent) { return false; }

// if it's indented more than 3 spaces, it should be a code block
if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }

// first character of the second line should be '|', '-', ':',
// and no other characters are allowed but spaces;
// basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp
Expand Down Expand Up @@ -3984,6 +4005,7 @@ module.exports = function table(state, startLine, endLine, silent) {

lineText = getLine(state, startLine).trim();
if (lineText.indexOf('|') === -1) { return false; }
if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));

// header row will define an amount of columns in the entire table,
Expand Down Expand Up @@ -4026,12 +4048,10 @@ module.exports = function table(state, startLine, endLine, silent) {
for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
if (state.sCount[nextLine] < state.blkIndent) { break; }

lineText = getLine(state, nextLine);
lineText = getLine(state, nextLine).trim();
if (lineText.indexOf('|') === -1) { break; }

// keep spaces at beginning of line to indicate an empty first cell, but
// strip trailing whitespace
columns = escapedSplit(lineText.replace(/^\||\|\s*$/g, ''));
if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }
columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));

token = state.push('tr_open', 'tr', 1);
for (i = 0; i < columnCount; i++) {
Expand Down Expand Up @@ -5330,6 +5350,9 @@ module.exports = function link(state, silent) {

'use strict';

var isSpace = require('../common/utils').isSpace;


module.exports = function newline(state, silent) {
var pmax, max, pos = state.pos;

Expand Down Expand Up @@ -5360,13 +5383,13 @@ module.exports = function newline(state, silent) {
pos++;

// skip heading spaces for next line
while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }

state.pos = pos;
return true;
};

},{}],47:[function(require,module,exports){
},{"../common/utils":4}],47:[function(require,module,exports){
// Inline parser state

'use strict';
Expand Down Expand Up @@ -6201,8 +6224,8 @@ function compile(self) {
.map(escapeRE)
.join('|');
// (?!_) cause 1.5x slowdown
self.re.schema_test = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
self.re.schema_search = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');
self.re.schema_test = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
self.re.schema_search = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');

self.re.pretest = RegExp(
'(' + self.re.schema_test.source + ')|' +
Expand Down Expand Up @@ -6602,10 +6625,14 @@ module.exports = function (opts) {
// \p{\Z\Cc} (white spaces + control)
re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');

// Experimental. List of chars, completely prohibited in links
// because can separate it from other part of text
var text_separators = '[><\uff5c]';

// All possible word characters (everything without punctuation, spaces & controls)
// Defined via punctuation & spaces to save space
// Should be something like \p{\L\N\S\M} (\w but without `_`)
re.src_pseudo_letter = '(?:(?!>|<|' + re.src_ZPCc + ')' + re.src_Any + ')';
re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';
// The same as abothe but without [0-9]
// var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';

Expand All @@ -6624,14 +6651,14 @@ module.exports = function (opts) {

re.src_host_terminator =

'(?=$|>|<|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';
'(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';

re.src_path =

'(?:' +
'[/?#]' +
'(?:' +
'(?!' + re.src_ZCc + '|[()[\\]{}.,"\'?!\\-<>]).|' +
'(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
'\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
'\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
'\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
Expand Down Expand Up @@ -6741,19 +6768,19 @@ module.exports = function (opts) {

re.tpl_email_fuzzy =

'(^|<|>|\\(|' + re.src_ZCc + ')(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';
'(^|' + text_separators + '|\\(|' + re.src_ZCc + ')(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';

re.tpl_link_fuzzy =
// Fuzzy link can't be prepended with .:/\- and non punctuation.
// but can start with > (markdown blockquote)
'(^|(?![.:/\\-_@])(?:[$+<=>^`|]|' + re.src_ZPCc + '))' +
'((?![$+<=>^`|])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';
'(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
'((?![$+<=>^`|\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';

re.tpl_link_no_ip_fuzzy =
// Fuzzy link can't be prepended with .:/\- and non punctuation.
// but can start with > (markdown blockquote)
'(^|(?![.:/\\-_@])(?:[$+<=>^`|]|' + re.src_ZPCc + '))' +
'((?![$+<=>^`|])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';
'(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
'((?![$+<=>^`|\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';

return re;
};
Expand Down

0 comments on commit b670878

Please sign in to comment.