Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/markdown
File: markdown.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
(function(mod) {
[3] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[4] Fix | Delete
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
[5] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[6] Fix | Delete
define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
[7] Fix | Delete
else // Plain browser env
[8] Fix | Delete
mod(CodeMirror);
[9] Fix | Delete
})(function(CodeMirror) {
[10] Fix | Delete
"use strict";
[11] Fix | Delete
[12] Fix | Delete
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
[13] Fix | Delete
[14] Fix | Delete
var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
[15] Fix | Delete
var htmlModeMissing = htmlMode.name == "null"
[16] Fix | Delete
[17] Fix | Delete
function getMode(name) {
[18] Fix | Delete
if (CodeMirror.findModeByName) {
[19] Fix | Delete
var found = CodeMirror.findModeByName(name);
[20] Fix | Delete
if (found) name = found.mime || found.mimes[0];
[21] Fix | Delete
}
[22] Fix | Delete
var mode = CodeMirror.getMode(cmCfg, name);
[23] Fix | Delete
return mode.name == "null" ? null : mode;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
// Should characters that affect highlighting be highlighted separate?
[27] Fix | Delete
// Does not include characters that will be output (such as `1.` and `-` for lists)
[28] Fix | Delete
if (modeCfg.highlightFormatting === undefined)
[29] Fix | Delete
modeCfg.highlightFormatting = false;
[30] Fix | Delete
[31] Fix | Delete
// Maximum number of nested blockquotes. Set to 0 for infinite nesting.
[32] Fix | Delete
// Excess `>` will emit `error` token.
[33] Fix | Delete
if (modeCfg.maxBlockquoteDepth === undefined)
[34] Fix | Delete
modeCfg.maxBlockquoteDepth = 0;
[35] Fix | Delete
[36] Fix | Delete
// Should underscores in words open/close em/strong?
[37] Fix | Delete
if (modeCfg.underscoresBreakWords === undefined)
[38] Fix | Delete
modeCfg.underscoresBreakWords = true;
[39] Fix | Delete
[40] Fix | Delete
// Use `fencedCodeBlocks` to configure fenced code blocks. false to
[41] Fix | Delete
// disable, string to specify a precise regexp that the fence should
[42] Fix | Delete
// match, and true to allow three or more backticks or tildes (as
[43] Fix | Delete
// per CommonMark).
[44] Fix | Delete
[45] Fix | Delete
// Turn on task lists? ("- [ ] " and "- [x] ")
[46] Fix | Delete
if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
[47] Fix | Delete
[48] Fix | Delete
// Turn on strikethrough syntax
[49] Fix | Delete
if (modeCfg.strikethrough === undefined)
[50] Fix | Delete
modeCfg.strikethrough = false;
[51] Fix | Delete
[52] Fix | Delete
// Allow token types to be overridden by user-provided token types.
[53] Fix | Delete
if (modeCfg.tokenTypeOverrides === undefined)
[54] Fix | Delete
modeCfg.tokenTypeOverrides = {};
[55] Fix | Delete
[56] Fix | Delete
var tokenTypes = {
[57] Fix | Delete
header: "header",
[58] Fix | Delete
code: "comment",
[59] Fix | Delete
quote: "quote",
[60] Fix | Delete
list1: "variable-2",
[61] Fix | Delete
list2: "variable-3",
[62] Fix | Delete
list3: "keyword",
[63] Fix | Delete
hr: "hr",
[64] Fix | Delete
image: "image",
[65] Fix | Delete
imageAltText: "image-alt-text",
[66] Fix | Delete
imageMarker: "image-marker",
[67] Fix | Delete
formatting: "formatting",
[68] Fix | Delete
linkInline: "link",
[69] Fix | Delete
linkEmail: "link",
[70] Fix | Delete
linkText: "link",
[71] Fix | Delete
linkHref: "string",
[72] Fix | Delete
em: "em",
[73] Fix | Delete
strong: "strong",
[74] Fix | Delete
strikethrough: "strikethrough"
[75] Fix | Delete
};
[76] Fix | Delete
[77] Fix | Delete
for (var tokenType in tokenTypes) {
[78] Fix | Delete
if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
[79] Fix | Delete
tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
[84] Fix | Delete
, ulRE = /^[*\-+]\s+/
[85] Fix | Delete
, olRE = /^[0-9]+([.)])\s+/
[86] Fix | Delete
, taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
[87] Fix | Delete
, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
[88] Fix | Delete
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
[89] Fix | Delete
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/
[90] Fix | Delete
, fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
[91] Fix | Delete
")[ \\t]*([\\w+#\-]*)");
[92] Fix | Delete
[93] Fix | Delete
function switchInline(stream, state, f) {
[94] Fix | Delete
state.f = state.inline = f;
[95] Fix | Delete
return f(stream, state);
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
function switchBlock(stream, state, f) {
[99] Fix | Delete
state.f = state.block = f;
[100] Fix | Delete
return f(stream, state);
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
function lineIsEmpty(line) {
[104] Fix | Delete
return !line || !/\S/.test(line.string)
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
// Blocks
[108] Fix | Delete
[109] Fix | Delete
function blankLine(state) {
[110] Fix | Delete
// Reset linkTitle state
[111] Fix | Delete
state.linkTitle = false;
[112] Fix | Delete
// Reset EM state
[113] Fix | Delete
state.em = false;
[114] Fix | Delete
// Reset STRONG state
[115] Fix | Delete
state.strong = false;
[116] Fix | Delete
// Reset strikethrough state
[117] Fix | Delete
state.strikethrough = false;
[118] Fix | Delete
// Reset state.quote
[119] Fix | Delete
state.quote = 0;
[120] Fix | Delete
// Reset state.indentedCode
[121] Fix | Delete
state.indentedCode = false;
[122] Fix | Delete
if (htmlModeMissing && state.f == htmlBlock) {
[123] Fix | Delete
state.f = inlineNormal;
[124] Fix | Delete
state.block = blockNormal;
[125] Fix | Delete
}
[126] Fix | Delete
// Reset state.trailingSpace
[127] Fix | Delete
state.trailingSpace = 0;
[128] Fix | Delete
state.trailingSpaceNewLine = false;
[129] Fix | Delete
// Mark this line as blank
[130] Fix | Delete
state.prevLine = state.thisLine
[131] Fix | Delete
state.thisLine = null
[132] Fix | Delete
return null;
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
function blockNormal(stream, state) {
[136] Fix | Delete
[137] Fix | Delete
var sol = stream.sol();
[138] Fix | Delete
[139] Fix | Delete
var prevLineIsList = state.list !== false,
[140] Fix | Delete
prevLineIsIndentedCode = state.indentedCode;
[141] Fix | Delete
[142] Fix | Delete
state.indentedCode = false;
[143] Fix | Delete
[144] Fix | Delete
if (prevLineIsList) {
[145] Fix | Delete
if (state.indentationDiff >= 0) { // Continued list
[146] Fix | Delete
if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
[147] Fix | Delete
state.indentation -= state.indentationDiff;
[148] Fix | Delete
}
[149] Fix | Delete
state.list = null;
[150] Fix | Delete
} else if (state.indentation > 0) {
[151] Fix | Delete
state.list = null;
[152] Fix | Delete
} else { // No longer a list
[153] Fix | Delete
state.list = false;
[154] Fix | Delete
}
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
var match = null;
[158] Fix | Delete
if (state.indentationDiff >= 4) {
[159] Fix | Delete
stream.skipToEnd();
[160] Fix | Delete
if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
[161] Fix | Delete
state.indentation -= 4;
[162] Fix | Delete
state.indentedCode = true;
[163] Fix | Delete
return tokenTypes.code;
[164] Fix | Delete
} else {
[165] Fix | Delete
return null;
[166] Fix | Delete
}
[167] Fix | Delete
} else if (stream.eatSpace()) {
[168] Fix | Delete
return null;
[169] Fix | Delete
} else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
[170] Fix | Delete
state.header = match[1].length;
[171] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "header";
[172] Fix | Delete
state.f = state.inline;
[173] Fix | Delete
return getType(state);
[174] Fix | Delete
} else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&
[175] Fix | Delete
!prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
[176] Fix | Delete
state.header = match[0].charAt(0) == '=' ? 1 : 2;
[177] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "header";
[178] Fix | Delete
state.f = state.inline;
[179] Fix | Delete
return getType(state);
[180] Fix | Delete
} else if (stream.eat('>')) {
[181] Fix | Delete
state.quote = sol ? 1 : state.quote + 1;
[182] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "quote";
[183] Fix | Delete
stream.eatSpace();
[184] Fix | Delete
return getType(state);
[185] Fix | Delete
} else if (stream.peek() === '[') {
[186] Fix | Delete
return switchInline(stream, state, footnoteLink);
[187] Fix | Delete
} else if (stream.match(hrRE, true)) {
[188] Fix | Delete
state.hr = true;
[189] Fix | Delete
return tokenTypes.hr;
[190] Fix | Delete
} else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
[191] Fix | Delete
var listType = null;
[192] Fix | Delete
if (stream.match(ulRE, true)) {
[193] Fix | Delete
listType = 'ul';
[194] Fix | Delete
} else {
[195] Fix | Delete
stream.match(olRE, true);
[196] Fix | Delete
listType = 'ol';
[197] Fix | Delete
}
[198] Fix | Delete
state.indentation = stream.column() + stream.current().length;
[199] Fix | Delete
state.list = true;
[200] Fix | Delete
[201] Fix | Delete
// While this list item's marker's indentation
[202] Fix | Delete
// is less than the deepest list item's content's indentation,
[203] Fix | Delete
// pop the deepest list item indentation off the stack.
[204] Fix | Delete
while (state.listStack && stream.column() < state.listStack[state.listStack.length - 1]) {
[205] Fix | Delete
state.listStack.pop();
[206] Fix | Delete
}
[207] Fix | Delete
[208] Fix | Delete
// Add this list item's content's indentation to the stack
[209] Fix | Delete
state.listStack.push(state.indentation);
[210] Fix | Delete
[211] Fix | Delete
if (modeCfg.taskLists && stream.match(taskListRE, false)) {
[212] Fix | Delete
state.taskList = true;
[213] Fix | Delete
}
[214] Fix | Delete
state.f = state.inline;
[215] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
[216] Fix | Delete
return getType(state);
[217] Fix | Delete
} else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {
[218] Fix | Delete
state.fencedChars = match[1]
[219] Fix | Delete
// try switching mode
[220] Fix | Delete
state.localMode = getMode(match[2]);
[221] Fix | Delete
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
[222] Fix | Delete
state.f = state.block = local;
[223] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "code-block";
[224] Fix | Delete
state.code = -1
[225] Fix | Delete
return getType(state);
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
return switchInline(stream, state, state.inline);
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
function htmlBlock(stream, state) {
[232] Fix | Delete
var style = htmlMode.token(stream, state.htmlState);
[233] Fix | Delete
if (!htmlModeMissing) {
[234] Fix | Delete
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
[235] Fix | Delete
if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
[236] Fix | Delete
(!inner.state.context && inner.state.tokenize.isInText)) ||
[237] Fix | Delete
(state.md_inside && stream.current().indexOf(">") > -1)) {
[238] Fix | Delete
state.f = inlineNormal;
[239] Fix | Delete
state.block = blockNormal;
[240] Fix | Delete
state.htmlState = null;
[241] Fix | Delete
}
[242] Fix | Delete
}
[243] Fix | Delete
return style;
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
function local(stream, state) {
[247] Fix | Delete
if (state.fencedChars && stream.match(state.fencedChars, false)) {
[248] Fix | Delete
state.localMode = state.localState = null;
[249] Fix | Delete
state.f = state.block = leavingLocal;
[250] Fix | Delete
return null;
[251] Fix | Delete
} else if (state.localMode) {
[252] Fix | Delete
return state.localMode.token(stream, state.localState);
[253] Fix | Delete
} else {
[254] Fix | Delete
stream.skipToEnd();
[255] Fix | Delete
return tokenTypes.code;
[256] Fix | Delete
}
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
function leavingLocal(stream, state) {
[260] Fix | Delete
stream.match(state.fencedChars);
[261] Fix | Delete
state.block = blockNormal;
[262] Fix | Delete
state.f = inlineNormal;
[263] Fix | Delete
state.fencedChars = null;
[264] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "code-block";
[265] Fix | Delete
state.code = 1
[266] Fix | Delete
var returnType = getType(state);
[267] Fix | Delete
state.code = 0
[268] Fix | Delete
return returnType;
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
// Inline
[272] Fix | Delete
function getType(state) {
[273] Fix | Delete
var styles = [];
[274] Fix | Delete
[275] Fix | Delete
if (state.formatting) {
[276] Fix | Delete
styles.push(tokenTypes.formatting);
[277] Fix | Delete
[278] Fix | Delete
if (typeof state.formatting === "string") state.formatting = [state.formatting];
[279] Fix | Delete
[280] Fix | Delete
for (var i = 0; i < state.formatting.length; i++) {
[281] Fix | Delete
styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
[282] Fix | Delete
[283] Fix | Delete
if (state.formatting[i] === "header") {
[284] Fix | Delete
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
[285] Fix | Delete
}
[286] Fix | Delete
[287] Fix | Delete
// Add `formatting-quote` and `formatting-quote-#` for blockquotes
[288] Fix | Delete
// Add `error` instead if the maximum blockquote nesting depth is passed
[289] Fix | Delete
if (state.formatting[i] === "quote") {
[290] Fix | Delete
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
[291] Fix | Delete
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
[292] Fix | Delete
} else {
[293] Fix | Delete
styles.push("error");
[294] Fix | Delete
}
[295] Fix | Delete
}
[296] Fix | Delete
}
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
if (state.taskOpen) {
[300] Fix | Delete
styles.push("meta");
[301] Fix | Delete
return styles.length ? styles.join(' ') : null;
[302] Fix | Delete
}
[303] Fix | Delete
if (state.taskClosed) {
[304] Fix | Delete
styles.push("property");
[305] Fix | Delete
return styles.length ? styles.join(' ') : null;
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
if (state.linkHref) {
[309] Fix | Delete
styles.push(tokenTypes.linkHref, "url");
[310] Fix | Delete
} else { // Only apply inline styles to non-url text
[311] Fix | Delete
if (state.strong) { styles.push(tokenTypes.strong); }
[312] Fix | Delete
if (state.em) { styles.push(tokenTypes.em); }
[313] Fix | Delete
if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
[314] Fix | Delete
if (state.linkText) { styles.push(tokenTypes.linkText); }
[315] Fix | Delete
if (state.code) { styles.push(tokenTypes.code); }
[316] Fix | Delete
if (state.image) { styles.push(tokenTypes.image); }
[317] Fix | Delete
if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
[318] Fix | Delete
if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
[319] Fix | Delete
}
[320] Fix | Delete
[321] Fix | Delete
if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
[322] Fix | Delete
[323] Fix | Delete
if (state.quote) {
[324] Fix | Delete
styles.push(tokenTypes.quote);
[325] Fix | Delete
[326] Fix | Delete
// Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
[327] Fix | Delete
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
[328] Fix | Delete
styles.push(tokenTypes.quote + "-" + state.quote);
[329] Fix | Delete
} else {
[330] Fix | Delete
styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
[331] Fix | Delete
}
[332] Fix | Delete
}
[333] Fix | Delete
[334] Fix | Delete
if (state.list !== false) {
[335] Fix | Delete
var listMod = (state.listStack.length - 1) % 3;
[336] Fix | Delete
if (!listMod) {
[337] Fix | Delete
styles.push(tokenTypes.list1);
[338] Fix | Delete
} else if (listMod === 1) {
[339] Fix | Delete
styles.push(tokenTypes.list2);
[340] Fix | Delete
} else {
[341] Fix | Delete
styles.push(tokenTypes.list3);
[342] Fix | Delete
}
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
if (state.trailingSpaceNewLine) {
[346] Fix | Delete
styles.push("trailing-space-new-line");
[347] Fix | Delete
} else if (state.trailingSpace) {
[348] Fix | Delete
styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
return styles.length ? styles.join(' ') : null;
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
function handleText(stream, state) {
[355] Fix | Delete
if (stream.match(textRE, true)) {
[356] Fix | Delete
return getType(state);
[357] Fix | Delete
}
[358] Fix | Delete
return undefined;
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
function inlineNormal(stream, state) {
[362] Fix | Delete
var style = state.text(stream, state);
[363] Fix | Delete
if (typeof style !== 'undefined')
[364] Fix | Delete
return style;
[365] Fix | Delete
[366] Fix | Delete
if (state.list) { // List marker (*, +, -, 1., etc)
[367] Fix | Delete
state.list = null;
[368] Fix | Delete
return getType(state);
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
if (state.taskList) {
[372] Fix | Delete
var taskOpen = stream.match(taskListRE, true)[1] !== "x";
[373] Fix | Delete
if (taskOpen) state.taskOpen = true;
[374] Fix | Delete
else state.taskClosed = true;
[375] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "task";
[376] Fix | Delete
state.taskList = false;
[377] Fix | Delete
return getType(state);
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
state.taskOpen = false;
[381] Fix | Delete
state.taskClosed = false;
[382] Fix | Delete
[383] Fix | Delete
if (state.header && stream.match(/^#+$/, true)) {
[384] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "header";
[385] Fix | Delete
return getType(state);
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
// Get sol() value now, before character is consumed
[389] Fix | Delete
var sol = stream.sol();
[390] Fix | Delete
[391] Fix | Delete
var ch = stream.next();
[392] Fix | Delete
[393] Fix | Delete
// Matches link titles present on next line
[394] Fix | Delete
if (state.linkTitle) {
[395] Fix | Delete
state.linkTitle = false;
[396] Fix | Delete
var matchCh = ch;
[397] Fix | Delete
if (ch === '(') {
[398] Fix | Delete
matchCh = ')';
[399] Fix | Delete
}
[400] Fix | Delete
matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
[401] Fix | Delete
var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
[402] Fix | Delete
if (stream.match(new RegExp(regex), true)) {
[403] Fix | Delete
return tokenTypes.linkHref;
[404] Fix | Delete
}
[405] Fix | Delete
}
[406] Fix | Delete
[407] Fix | Delete
// If this block is changed, it may need to be updated in GFM mode
[408] Fix | Delete
if (ch === '`') {
[409] Fix | Delete
var previousFormatting = state.formatting;
[410] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "code";
[411] Fix | Delete
stream.eatWhile('`');
[412] Fix | Delete
var count = stream.current().length
[413] Fix | Delete
if (state.code == 0) {
[414] Fix | Delete
state.code = count
[415] Fix | Delete
return getType(state)
[416] Fix | Delete
} else if (count == state.code) { // Must be exact
[417] Fix | Delete
var t = getType(state)
[418] Fix | Delete
state.code = 0
[419] Fix | Delete
return t
[420] Fix | Delete
} else {
[421] Fix | Delete
state.formatting = previousFormatting
[422] Fix | Delete
return getType(state)
[423] Fix | Delete
}
[424] Fix | Delete
} else if (state.code) {
[425] Fix | Delete
return getType(state);
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
if (ch === '\\') {
[429] Fix | Delete
stream.next();
[430] Fix | Delete
if (modeCfg.highlightFormatting) {
[431] Fix | Delete
var type = getType(state);
[432] Fix | Delete
var formattingEscape = tokenTypes.formatting + "-escape";
[433] Fix | Delete
return type ? type + " " + formattingEscape : formattingEscape;
[434] Fix | Delete
}
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
[438] Fix | Delete
state.imageMarker = true;
[439] Fix | Delete
state.image = true;
[440] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "image";
[441] Fix | Delete
return getType(state);
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
if (ch === '[' && state.imageMarker) {
[445] Fix | Delete
state.imageMarker = false;
[446] Fix | Delete
state.imageAltText = true
[447] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "image";
[448] Fix | Delete
return getType(state);
[449] Fix | Delete
}
[450] Fix | Delete
[451] Fix | Delete
if (ch === ']' && state.imageAltText) {
[452] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "image";
[453] Fix | Delete
var type = getType(state);
[454] Fix | Delete
state.imageAltText = false;
[455] Fix | Delete
state.image = false;
[456] Fix | Delete
state.inline = state.f = linkHref;
[457] Fix | Delete
return type;
[458] Fix | Delete
}
[459] Fix | Delete
[460] Fix | Delete
if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false) && !state.image) {
[461] Fix | Delete
state.linkText = true;
[462] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "link";
[463] Fix | Delete
return getType(state);
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
if (ch === ']' && state.linkText && stream.match(/\(.*?\)| ?\[.*?\]/, false)) {
[467] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "link";
[468] Fix | Delete
var type = getType(state);
[469] Fix | Delete
state.linkText = false;
[470] Fix | Delete
state.inline = state.f = linkHref;
[471] Fix | Delete
return type;
[472] Fix | Delete
}
[473] Fix | Delete
[474] Fix | Delete
if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
[475] Fix | Delete
state.f = state.inline = linkInline;
[476] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "link";
[477] Fix | Delete
var type = getType(state);
[478] Fix | Delete
if (type){
[479] Fix | Delete
type += " ";
[480] Fix | Delete
} else {
[481] Fix | Delete
type = "";
[482] Fix | Delete
}
[483] Fix | Delete
return type + tokenTypes.linkInline;
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
[487] Fix | Delete
state.f = state.inline = linkInline;
[488] Fix | Delete
if (modeCfg.highlightFormatting) state.formatting = "link";
[489] Fix | Delete
var type = getType(state);
[490] Fix | Delete
if (type){
[491] Fix | Delete
type += " ";
[492] Fix | Delete
} else {
[493] Fix | Delete
type = "";
[494] Fix | Delete
}
[495] Fix | Delete
return type + tokenTypes.linkEmail;
[496] Fix | Delete
}
[497] Fix | Delete
[498] Fix | Delete
if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function