: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
var end = stream.string.indexOf(">", stream.pos);
var atts = stream.string.substring(stream.start, end);
if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
state.htmlState = CodeMirror.startState(htmlMode);
return switchBlock(stream, state, htmlBlock);
if (ch === '<' && stream.match(/^\/\w*?>/)) {
var ignoreUnderscore = false;
if (!modeCfg.underscoresBreakWords) {
if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
var prevPos = stream.pos - 2;
var prevCh = stream.string.charAt(prevPos);
if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {
if (sol && stream.peek() === ' ') {
// Do nothing, surrounded by newline and space
} else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
if (modeCfg.highlightFormatting) state.formatting = "strong";
} else if (!state.strong && stream.eat(ch)) { // Add STRONG
if (modeCfg.highlightFormatting) state.formatting = "strong";
} else if (state.em === ch) { // Remove EM
if (modeCfg.highlightFormatting) state.formatting = "em";
} else if (!state.em) { // Add EM
if (modeCfg.highlightFormatting) state.formatting = "em";
if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
} else { // Not surrounded by spaces, back up pointer
if (modeCfg.strikethrough) {
if (ch === '~' && stream.eatWhile(ch)) {
if (state.strikethrough) {// Remove strikethrough
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
state.strikethrough = false;
} else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
state.strikethrough = true;
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
if (stream.match(/^~~/, true)) { // Probably surrounded by space
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
} else { // Not surrounded by spaces, back up pointer
if (stream.match(/ +$/, false)) {
} else if (state.trailingSpace) {
state.trailingSpaceNewLine = true;
function linkInline(stream, state) {
state.f = state.inline = inlineNormal;
if (modeCfg.highlightFormatting) state.formatting = "link";
var type = getType(state);
return type + tokenTypes.linkInline;
stream.match(/^[^>]+/, true);
return tokenTypes.linkInline;
function linkHref(stream, state) {
// Check if space, and return NULL if so (to avoid marking the space)
if (ch === '(' || ch === '[') {
state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]", 0);
if (modeCfg.highlightFormatting) state.formatting = "link-string";
")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
"]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/
function getLinkHrefInside(endChar) {
return function(stream, state) {
state.f = state.inline = inlineNormal;
if (modeCfg.highlightFormatting) state.formatting = "link-string";
var returnState = getType(state);
stream.match(linkRE[endChar])
function footnoteLink(stream, state) {
if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
state.f = footnoteLinkInside;
stream.next(); // Consume [
if (modeCfg.highlightFormatting) state.formatting = "link";
return switchInline(stream, state, inlineNormal);
function footnoteLinkInside(stream, state) {
if (stream.match(/^\]:/, true)) {
state.f = state.inline = footnoteUrl;
if (modeCfg.highlightFormatting) state.formatting = "link";
var returnType = getType(state);
stream.match(/^([^\]\\]|\\.)+/, true);
return tokenTypes.linkText;
function footnoteUrl(stream, state) {
// Check if space, and return NULL if so (to avoid marking the space)
stream.match(/^[^\s]+/, true);
if (stream.peek() === undefined) { // End of line, set flag to check next line
} else { // More content on line, check if link title
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
state.f = state.inline = inlineNormal;
return tokenTypes.linkHref + " url";
trailingSpaceNewLine: false,
htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
indentation: s.indentation,
localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
strikethrough: s.strikethrough,
listStack: s.listStack.slice(0),
indentedCode: s.indentedCode,
trailingSpace: s.trailingSpace,
trailingSpaceNewLine: s.trailingSpaceNewLine,
fencedChars: s.fencedChars
token: function(stream, state) {
// Reset state.formatting
state.formatting = false;
if (stream != state.thisLine) {
var forceBlankLine = state.header || state.hr;
// Reset state.header and state.hr
if (stream.match(/^\s*$/, true) || forceBlankLine) {
if (!forceBlankLine) return null
state.prevLine = state.thisLine
// Reset state.trailingSpace
state.trailingSpaceNewLine = false;
var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
state.indentationDiff = Math.min(indentation - state.indentation, 4);
state.indentation = state.indentation + state.indentationDiff;
if (indentation > 0) return null;
return state.f(stream, state);
innerMode: function(state) {
if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
if (state.localState) return {state: state.localState, mode: state.localMode};
return {state: state, mode: mode};
CodeMirror.defineMIME("text/x-markdown", "markdown");