mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-07 01:54:27 -06:00
Update/download dependencies
This commit is contained in:
parent
c9db36af67
commit
f77dbc6aab
14
dist/simplemde.min.js
vendored
14
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -323,7 +323,7 @@ div.CodeMirror-dragcursors {
|
|||||||
@media print {
|
@media print {
|
||||||
/* Hide the cursor when printing */
|
/* Hide the cursor when printing */
|
||||||
.CodeMirror div.CodeMirror-cursors {
|
.CodeMirror div.CodeMirror-cursors {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,4 +331,4 @@ div.CodeMirror-dragcursors {
|
|||||||
.cm-tab-wrap-hack:after { content: ''; }
|
.cm-tab-wrap-hack:after { content: ''; }
|
||||||
|
|
||||||
/* Help users use markselection to safely style text background */
|
/* Help users use markselection to safely style text background */
|
||||||
span.CodeMirror-selectedtext { background: none; }
|
span.CodeMirror-selectedtext { background: none; }
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment) {
|
.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment) {
|
||||||
background: rgba(255, 0, 0, .15);
|
background: rgba(255, 0, 0, .15);
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -3,39 +3,39 @@
|
|||||||
|
|
||||||
(function(mod) {
|
(function(mod) {
|
||||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
mod(require("../../lib/codemirror"));
|
mod(require("../../lib/codemirror"));
|
||||||
else if (typeof define == "function" && define.amd) // AMD
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
define(["../../lib/codemirror"], mod);
|
define(["../../lib/codemirror"], mod);
|
||||||
else // Plain browser env
|
else // Plain browser env
|
||||||
mod(CodeMirror);
|
mod(CodeMirror);
|
||||||
})(function(CodeMirror) {
|
})(function(CodeMirror) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
|
CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
|
||||||
if (old == CodeMirror.Init) old = false;
|
if (old == CodeMirror.Init) old = false;
|
||||||
if (!old == !val) return;
|
if (!old == !val) return;
|
||||||
if (val) setFullscreen(cm);
|
if (val) setFullscreen(cm);
|
||||||
else setNormal(cm);
|
else setNormal(cm);
|
||||||
});
|
});
|
||||||
|
|
||||||
function setFullscreen(cm) {
|
function setFullscreen(cm) {
|
||||||
var wrap = cm.getWrapperElement();
|
var wrap = cm.getWrapperElement();
|
||||||
cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
|
cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
|
||||||
width: wrap.style.width, height: wrap.style.height};
|
width: wrap.style.width, height: wrap.style.height};
|
||||||
wrap.style.width = "";
|
wrap.style.width = "";
|
||||||
wrap.style.height = "auto";
|
wrap.style.height = "auto";
|
||||||
wrap.className += " CodeMirror-fullscreen";
|
wrap.className += " CodeMirror-fullscreen";
|
||||||
document.documentElement.style.overflow = "hidden";
|
document.documentElement.style.overflow = "hidden";
|
||||||
cm.refresh();
|
cm.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNormal(cm) {
|
function setNormal(cm) {
|
||||||
var wrap = cm.getWrapperElement();
|
var wrap = cm.getWrapperElement();
|
||||||
wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
|
wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
|
||||||
document.documentElement.style.overflow = "";
|
document.documentElement.style.overflow = "";
|
||||||
var info = cm.state.fullScreenRestore;
|
var info = cm.state.fullScreenRestore;
|
||||||
wrap.style.width = info.width; wrap.style.height = info.height;
|
wrap.style.width = info.width; wrap.style.height = info.height;
|
||||||
window.scrollTo(info.scrollLeft, info.scrollTop);
|
window.scrollTo(info.scrollLeft, info.scrollTop);
|
||||||
cm.refresh();
|
cm.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,74 +12,74 @@
|
|||||||
|
|
||||||
(function(mod) {
|
(function(mod) {
|
||||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
mod(require("../../lib/codemirror"));
|
mod(require("../../lib/codemirror"));
|
||||||
else if (typeof define == "function" && define.amd) // AMD
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
define(["../../lib/codemirror"], mod);
|
define(["../../lib/codemirror"], mod);
|
||||||
else // Plain browser env
|
else // Plain browser env
|
||||||
mod(CodeMirror);
|
mod(CodeMirror);
|
||||||
})(function(CodeMirror) {
|
})(function(CodeMirror) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
CodeMirror.overlayMode = function(base, overlay, combine) {
|
CodeMirror.overlayMode = function(base, overlay, combine) {
|
||||||
return {
|
return {
|
||||||
startState: function() {
|
startState: function() {
|
||||||
return {
|
return {
|
||||||
base: CodeMirror.startState(base),
|
base: CodeMirror.startState(base),
|
||||||
overlay: CodeMirror.startState(overlay),
|
overlay: CodeMirror.startState(overlay),
|
||||||
basePos: 0, baseCur: null,
|
basePos: 0, baseCur: null,
|
||||||
overlayPos: 0, overlayCur: null,
|
overlayPos: 0, overlayCur: null,
|
||||||
streamSeen: null
|
streamSeen: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
copyState: function(state) {
|
copyState: function(state) {
|
||||||
return {
|
return {
|
||||||
base: CodeMirror.copyState(base, state.base),
|
base: CodeMirror.copyState(base, state.base),
|
||||||
overlay: CodeMirror.copyState(overlay, state.overlay),
|
overlay: CodeMirror.copyState(overlay, state.overlay),
|
||||||
basePos: state.basePos, baseCur: null,
|
basePos: state.basePos, baseCur: null,
|
||||||
overlayPos: state.overlayPos, overlayCur: null
|
overlayPos: state.overlayPos, overlayCur: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
token: function(stream, state) {
|
token: function(stream, state) {
|
||||||
if (stream != state.streamSeen ||
|
if (stream != state.streamSeen ||
|
||||||
Math.min(state.basePos, state.overlayPos) < stream.start) {
|
Math.min(state.basePos, state.overlayPos) < stream.start) {
|
||||||
state.streamSeen = stream;
|
state.streamSeen = stream;
|
||||||
state.basePos = state.overlayPos = stream.start;
|
state.basePos = state.overlayPos = stream.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.start == state.basePos) {
|
if (stream.start == state.basePos) {
|
||||||
state.baseCur = base.token(stream, state.base);
|
state.baseCur = base.token(stream, state.base);
|
||||||
state.basePos = stream.pos;
|
state.basePos = stream.pos;
|
||||||
}
|
}
|
||||||
if (stream.start == state.overlayPos) {
|
if (stream.start == state.overlayPos) {
|
||||||
stream.pos = stream.start;
|
stream.pos = stream.start;
|
||||||
state.overlayCur = overlay.token(stream, state.overlay);
|
state.overlayCur = overlay.token(stream, state.overlay);
|
||||||
state.overlayPos = stream.pos;
|
state.overlayPos = stream.pos;
|
||||||
}
|
}
|
||||||
stream.pos = Math.min(state.basePos, state.overlayPos);
|
stream.pos = Math.min(state.basePos, state.overlayPos);
|
||||||
|
|
||||||
// state.overlay.combineTokens always takes precedence over combine,
|
// state.overlay.combineTokens always takes precedence over combine,
|
||||||
// unless set to null
|
// unless set to null
|
||||||
if (state.overlayCur == null) return state.baseCur;
|
if (state.overlayCur == null) return state.baseCur;
|
||||||
else if (state.baseCur != null &&
|
else if (state.baseCur != null &&
|
||||||
state.overlay.combineTokens ||
|
state.overlay.combineTokens ||
|
||||||
combine && state.overlay.combineTokens == null)
|
combine && state.overlay.combineTokens == null)
|
||||||
return state.baseCur + " " + state.overlayCur;
|
return state.baseCur + " " + state.overlayCur;
|
||||||
else return state.overlayCur;
|
else return state.overlayCur;
|
||||||
},
|
},
|
||||||
|
|
||||||
indent: base.indent && function(state, textAfter) {
|
indent: base.indent && function(state, textAfter) {
|
||||||
return base.indent(state.base, textAfter);
|
return base.indent(state.base, textAfter);
|
||||||
},
|
},
|
||||||
electricChars: base.electricChars,
|
electricChars: base.electricChars,
|
||||||
|
|
||||||
innerMode: function(state) { return {state: state.base, mode: base}; },
|
innerMode: function(state) { return {state: state.base, mode: base}; },
|
||||||
|
|
||||||
blankLine: function(state) {
|
blankLine: function(state) {
|
||||||
if (base.blankLine) base.blankLine(state.base);
|
if (base.blankLine) base.blankLine(state.base);
|
||||||
if (overlay.blankLine) overlay.blankLine(state.overlay);
|
if (overlay.blankLine) overlay.blankLine(state.overlay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
(function(mod) {
|
(function(mod) {
|
||||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
mod(require("../../lib/codemirror"));
|
mod(require("../../lib/codemirror"));
|
||||||
else if (typeof define == "function" && define.amd) // AMD
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
define(["../../lib/codemirror"], mod);
|
define(["../../lib/codemirror"], mod);
|
||||||
else // Plain browser env
|
else // Plain browser env
|
||||||
mod(CodeMirror);
|
mod(CodeMirror);
|
||||||
})(function(CodeMirror) {
|
})(function(CodeMirror) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -18,45 +18,45 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
|
|||||||
if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true;
|
if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true;
|
||||||
|
|
||||||
var Kludges = parserConfig.htmlMode ? {
|
var Kludges = parserConfig.htmlMode ? {
|
||||||
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
||||||
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
||||||
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
||||||
'track': true, 'wbr': true, 'menuitem': true},
|
'track': true, 'wbr': true, 'menuitem': true},
|
||||||
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
||||||
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
||||||
'th': true, 'tr': true},
|
'th': true, 'tr': true},
|
||||||
contextGrabbers: {
|
contextGrabbers: {
|
||||||
'dd': {'dd': true, 'dt': true},
|
'dd': {'dd': true, 'dt': true},
|
||||||
'dt': {'dd': true, 'dt': true},
|
'dt': {'dd': true, 'dt': true},
|
||||||
'li': {'li': true},
|
'li': {'li': true},
|
||||||
'option': {'option': true, 'optgroup': true},
|
'option': {'option': true, 'optgroup': true},
|
||||||
'optgroup': {'optgroup': true},
|
'optgroup': {'optgroup': true},
|
||||||
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
||||||
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
||||||
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
||||||
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
||||||
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
||||||
'rp': {'rp': true, 'rt': true},
|
'rp': {'rp': true, 'rt': true},
|
||||||
'rt': {'rp': true, 'rt': true},
|
'rt': {'rp': true, 'rt': true},
|
||||||
'tbody': {'tbody': true, 'tfoot': true},
|
'tbody': {'tbody': true, 'tfoot': true},
|
||||||
'td': {'td': true, 'th': true},
|
'td': {'td': true, 'th': true},
|
||||||
'tfoot': {'tbody': true},
|
'tfoot': {'tbody': true},
|
||||||
'th': {'td': true, 'th': true},
|
'th': {'td': true, 'th': true},
|
||||||
'thead': {'tbody': true, 'tfoot': true},
|
'thead': {'tbody': true, 'tfoot': true},
|
||||||
'tr': {'tr': true}
|
'tr': {'tr': true}
|
||||||
},
|
},
|
||||||
doNotIndent: {"pre": true},
|
doNotIndent: {"pre": true},
|
||||||
allowUnquoted: true,
|
allowUnquoted: true,
|
||||||
allowMissing: true,
|
allowMissing: true,
|
||||||
caseFold: true
|
caseFold: true
|
||||||
} : {
|
} : {
|
||||||
autoSelfClosers: {},
|
autoSelfClosers: {},
|
||||||
implicitlyClosed: {},
|
implicitlyClosed: {},
|
||||||
contextGrabbers: {},
|
contextGrabbers: {},
|
||||||
doNotIndent: {},
|
doNotIndent: {},
|
||||||
allowUnquoted: false,
|
allowUnquoted: false,
|
||||||
allowMissing: false,
|
allowMissing: false,
|
||||||
caseFold: false
|
caseFold: false
|
||||||
};
|
};
|
||||||
var alignCDATA = parserConfig.alignCDATA;
|
var alignCDATA = parserConfig.alignCDATA;
|
||||||
|
|
||||||
@ -64,316 +64,316 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
|
|||||||
var type, setStyle;
|
var type, setStyle;
|
||||||
|
|
||||||
function inText(stream, state) {
|
function inText(stream, state) {
|
||||||
function chain(parser) {
|
function chain(parser) {
|
||||||
state.tokenize = parser;
|
state.tokenize = parser;
|
||||||
return parser(stream, state);
|
return parser(stream, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ch = stream.next();
|
var ch = stream.next();
|
||||||
if (ch == "<") {
|
if (ch == "<") {
|
||||||
if (stream.eat("!")) {
|
if (stream.eat("!")) {
|
||||||
if (stream.eat("[")) {
|
if (stream.eat("[")) {
|
||||||
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
||||||
else return null;
|
else return null;
|
||||||
} else if (stream.match("--")) {
|
} else if (stream.match("--")) {
|
||||||
return chain(inBlock("comment", "-->"));
|
return chain(inBlock("comment", "-->"));
|
||||||
} else if (stream.match("DOCTYPE", true, true)) {
|
} else if (stream.match("DOCTYPE", true, true)) {
|
||||||
stream.eatWhile(/[\w\._\-]/);
|
stream.eatWhile(/[\w\._\-]/);
|
||||||
return chain(doctype(1));
|
return chain(doctype(1));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (stream.eat("?")) {
|
} else if (stream.eat("?")) {
|
||||||
stream.eatWhile(/[\w\._\-]/);
|
stream.eatWhile(/[\w\._\-]/);
|
||||||
state.tokenize = inBlock("meta", "?>");
|
state.tokenize = inBlock("meta", "?>");
|
||||||
return "meta";
|
return "meta";
|
||||||
} else {
|
} else {
|
||||||
type = stream.eat("/") ? "closeTag" : "openTag";
|
type = stream.eat("/") ? "closeTag" : "openTag";
|
||||||
state.tokenize = inTag;
|
state.tokenize = inTag;
|
||||||
return "tag bracket";
|
return "tag bracket";
|
||||||
}
|
}
|
||||||
} else if (ch == "&") {
|
} else if (ch == "&") {
|
||||||
var ok;
|
var ok;
|
||||||
if (stream.eat("#")) {
|
if (stream.eat("#")) {
|
||||||
if (stream.eat("x")) {
|
if (stream.eat("x")) {
|
||||||
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
||||||
} else {
|
} else {
|
||||||
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
||||||
}
|
}
|
||||||
return ok ? "atom" : "error";
|
return ok ? "atom" : "error";
|
||||||
} else {
|
} else {
|
||||||
stream.eatWhile(/[^&<]/);
|
stream.eatWhile(/[^&<]/);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inText.isInText = true;
|
inText.isInText = true;
|
||||||
|
|
||||||
function inTag(stream, state) {
|
function inTag(stream, state) {
|
||||||
var ch = stream.next();
|
var ch = stream.next();
|
||||||
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
||||||
state.tokenize = inText;
|
state.tokenize = inText;
|
||||||
type = ch == ">" ? "endTag" : "selfcloseTag";
|
type = ch == ">" ? "endTag" : "selfcloseTag";
|
||||||
return "tag bracket";
|
return "tag bracket";
|
||||||
} else if (ch == "=") {
|
} else if (ch == "=") {
|
||||||
type = "equals";
|
type = "equals";
|
||||||
return null;
|
return null;
|
||||||
} else if (ch == "<") {
|
} else if (ch == "<") {
|
||||||
state.tokenize = inText;
|
state.tokenize = inText;
|
||||||
state.state = baseState;
|
state.state = baseState;
|
||||||
state.tagName = state.tagStart = null;
|
state.tagName = state.tagStart = null;
|
||||||
var next = state.tokenize(stream, state);
|
var next = state.tokenize(stream, state);
|
||||||
return next ? next + " tag error" : "tag error";
|
return next ? next + " tag error" : "tag error";
|
||||||
} else if (/[\'\"]/.test(ch)) {
|
} else if (/[\'\"]/.test(ch)) {
|
||||||
state.tokenize = inAttribute(ch);
|
state.tokenize = inAttribute(ch);
|
||||||
state.stringStartCol = stream.column();
|
state.stringStartCol = stream.column();
|
||||||
return state.tokenize(stream, state);
|
return state.tokenize(stream, state);
|
||||||
} else {
|
} else {
|
||||||
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
|
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
|
||||||
return "word";
|
return "word";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function inAttribute(quote) {
|
function inAttribute(quote) {
|
||||||
var closure = function(stream, state) {
|
var closure = function(stream, state) {
|
||||||
while (!stream.eol()) {
|
while (!stream.eol()) {
|
||||||
if (stream.next() == quote) {
|
if (stream.next() == quote) {
|
||||||
state.tokenize = inTag;
|
state.tokenize = inTag;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "string";
|
return "string";
|
||||||
};
|
};
|
||||||
closure.isInAttribute = true;
|
closure.isInAttribute = true;
|
||||||
return closure;
|
return closure;
|
||||||
}
|
}
|
||||||
|
|
||||||
function inBlock(style, terminator) {
|
function inBlock(style, terminator) {
|
||||||
return function(stream, state) {
|
return function(stream, state) {
|
||||||
while (!stream.eol()) {
|
while (!stream.eol()) {
|
||||||
if (stream.match(terminator)) {
|
if (stream.match(terminator)) {
|
||||||
state.tokenize = inText;
|
state.tokenize = inText;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stream.next();
|
stream.next();
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function doctype(depth) {
|
function doctype(depth) {
|
||||||
return function(stream, state) {
|
return function(stream, state) {
|
||||||
var ch;
|
var ch;
|
||||||
while ((ch = stream.next()) != null) {
|
while ((ch = stream.next()) != null) {
|
||||||
if (ch == "<") {
|
if (ch == "<") {
|
||||||
state.tokenize = doctype(depth + 1);
|
state.tokenize = doctype(depth + 1);
|
||||||
return state.tokenize(stream, state);
|
return state.tokenize(stream, state);
|
||||||
} else if (ch == ">") {
|
} else if (ch == ">") {
|
||||||
if (depth == 1) {
|
if (depth == 1) {
|
||||||
state.tokenize = inText;
|
state.tokenize = inText;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
state.tokenize = doctype(depth - 1);
|
state.tokenize = doctype(depth - 1);
|
||||||
return state.tokenize(stream, state);
|
return state.tokenize(stream, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "meta";
|
return "meta";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function Context(state, tagName, startOfLine) {
|
function Context(state, tagName, startOfLine) {
|
||||||
this.prev = state.context;
|
this.prev = state.context;
|
||||||
this.tagName = tagName;
|
this.tagName = tagName;
|
||||||
this.indent = state.indented;
|
this.indent = state.indented;
|
||||||
this.startOfLine = startOfLine;
|
this.startOfLine = startOfLine;
|
||||||
if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
||||||
this.noIndent = true;
|
this.noIndent = true;
|
||||||
}
|
}
|
||||||
function popContext(state) {
|
function popContext(state) {
|
||||||
if (state.context) state.context = state.context.prev;
|
if (state.context) state.context = state.context.prev;
|
||||||
}
|
}
|
||||||
function maybePopContext(state, nextTagName) {
|
function maybePopContext(state, nextTagName) {
|
||||||
var parentTagName;
|
var parentTagName;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!state.context) {
|
if (!state.context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parentTagName = state.context.tagName;
|
parentTagName = state.context.tagName;
|
||||||
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
|
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
|
||||||
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
popContext(state);
|
popContext(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function baseState(type, stream, state) {
|
function baseState(type, stream, state) {
|
||||||
if (type == "openTag") {
|
if (type == "openTag") {
|
||||||
state.tagStart = stream.column();
|
state.tagStart = stream.column();
|
||||||
return tagNameState;
|
return tagNameState;
|
||||||
} else if (type == "closeTag") {
|
} else if (type == "closeTag") {
|
||||||
return closeTagNameState;
|
return closeTagNameState;
|
||||||
} else {
|
} else {
|
||||||
return baseState;
|
return baseState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function tagNameState(type, stream, state) {
|
function tagNameState(type, stream, state) {
|
||||||
if (type == "word") {
|
if (type == "word") {
|
||||||
state.tagName = stream.current();
|
state.tagName = stream.current();
|
||||||
setStyle = "tag";
|
setStyle = "tag";
|
||||||
return attrState;
|
return attrState;
|
||||||
} else {
|
} else {
|
||||||
setStyle = "error";
|
setStyle = "error";
|
||||||
return tagNameState;
|
return tagNameState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function closeTagNameState(type, stream, state) {
|
function closeTagNameState(type, stream, state) {
|
||||||
if (type == "word") {
|
if (type == "word") {
|
||||||
var tagName = stream.current();
|
var tagName = stream.current();
|
||||||
if (state.context && state.context.tagName != tagName &&
|
if (state.context && state.context.tagName != tagName &&
|
||||||
Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
||||||
popContext(state);
|
popContext(state);
|
||||||
if (state.context && state.context.tagName == tagName) {
|
if (state.context && state.context.tagName == tagName) {
|
||||||
setStyle = "tag";
|
setStyle = "tag";
|
||||||
return closeState;
|
return closeState;
|
||||||
} else {
|
} else {
|
||||||
setStyle = "tag error";
|
setStyle = "tag error";
|
||||||
return closeStateErr;
|
return closeStateErr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setStyle = "error";
|
setStyle = "error";
|
||||||
return closeStateErr;
|
return closeStateErr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeState(type, _stream, state) {
|
function closeState(type, _stream, state) {
|
||||||
if (type != "endTag") {
|
if (type != "endTag") {
|
||||||
setStyle = "error";
|
setStyle = "error";
|
||||||
return closeState;
|
return closeState;
|
||||||
}
|
}
|
||||||
popContext(state);
|
popContext(state);
|
||||||
return baseState;
|
return baseState;
|
||||||
}
|
}
|
||||||
function closeStateErr(type, stream, state) {
|
function closeStateErr(type, stream, state) {
|
||||||
setStyle = "error";
|
setStyle = "error";
|
||||||
return closeState(type, stream, state);
|
return closeState(type, stream, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function attrState(type, _stream, state) {
|
function attrState(type, _stream, state) {
|
||||||
if (type == "word") {
|
if (type == "word") {
|
||||||
setStyle = "attribute";
|
setStyle = "attribute";
|
||||||
return attrEqState;
|
return attrEqState;
|
||||||
} else if (type == "endTag" || type == "selfcloseTag") {
|
} else if (type == "endTag" || type == "selfcloseTag") {
|
||||||
var tagName = state.tagName, tagStart = state.tagStart;
|
var tagName = state.tagName, tagStart = state.tagStart;
|
||||||
state.tagName = state.tagStart = null;
|
state.tagName = state.tagStart = null;
|
||||||
if (type == "selfcloseTag" ||
|
if (type == "selfcloseTag" ||
|
||||||
Kludges.autoSelfClosers.hasOwnProperty(tagName)) {
|
Kludges.autoSelfClosers.hasOwnProperty(tagName)) {
|
||||||
maybePopContext(state, tagName);
|
maybePopContext(state, tagName);
|
||||||
} else {
|
} else {
|
||||||
maybePopContext(state, tagName);
|
maybePopContext(state, tagName);
|
||||||
state.context = new Context(state, tagName, tagStart == state.indented);
|
state.context = new Context(state, tagName, tagStart == state.indented);
|
||||||
}
|
}
|
||||||
return baseState;
|
return baseState;
|
||||||
}
|
}
|
||||||
setStyle = "error";
|
setStyle = "error";
|
||||||
return attrState;
|
return attrState;
|
||||||
}
|
}
|
||||||
function attrEqState(type, stream, state) {
|
function attrEqState(type, stream, state) {
|
||||||
if (type == "equals") return attrValueState;
|
if (type == "equals") return attrValueState;
|
||||||
if (!Kludges.allowMissing) setStyle = "error";
|
if (!Kludges.allowMissing) setStyle = "error";
|
||||||
return attrState(type, stream, state);
|
return attrState(type, stream, state);
|
||||||
}
|
}
|
||||||
function attrValueState(type, stream, state) {
|
function attrValueState(type, stream, state) {
|
||||||
if (type == "string") return attrContinuedState;
|
if (type == "string") return attrContinuedState;
|
||||||
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;}
|
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;}
|
||||||
setStyle = "error";
|
setStyle = "error";
|
||||||
return attrState(type, stream, state);
|
return attrState(type, stream, state);
|
||||||
}
|
}
|
||||||
function attrContinuedState(type, stream, state) {
|
function attrContinuedState(type, stream, state) {
|
||||||
if (type == "string") return attrContinuedState;
|
if (type == "string") return attrContinuedState;
|
||||||
return attrState(type, stream, state);
|
return attrState(type, stream, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
startState: function() {
|
startState: function() {
|
||||||
return {tokenize: inText,
|
return {tokenize: inText,
|
||||||
state: baseState,
|
state: baseState,
|
||||||
indented: 0,
|
indented: 0,
|
||||||
tagName: null, tagStart: null,
|
tagName: null, tagStart: null,
|
||||||
context: null};
|
context: null};
|
||||||
},
|
},
|
||||||
|
|
||||||
token: function(stream, state) {
|
token: function(stream, state) {
|
||||||
if (!state.tagName && stream.sol())
|
if (!state.tagName && stream.sol())
|
||||||
state.indented = stream.indentation();
|
state.indented = stream.indentation();
|
||||||
|
|
||||||
if (stream.eatSpace()) return null;
|
if (stream.eatSpace()) return null;
|
||||||
type = null;
|
type = null;
|
||||||
var style = state.tokenize(stream, state);
|
var style = state.tokenize(stream, state);
|
||||||
if ((style || type) && style != "comment") {
|
if ((style || type) && style != "comment") {
|
||||||
setStyle = null;
|
setStyle = null;
|
||||||
state.state = state.state(type || style, stream, state);
|
state.state = state.state(type || style, stream, state);
|
||||||
if (setStyle)
|
if (setStyle)
|
||||||
style = setStyle == "error" ? style + " error" : setStyle;
|
style = setStyle == "error" ? style + " error" : setStyle;
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
},
|
},
|
||||||
|
|
||||||
indent: function(state, textAfter, fullLine) {
|
indent: function(state, textAfter, fullLine) {
|
||||||
var context = state.context;
|
var context = state.context;
|
||||||
// Indent multi-line strings (e.g. css).
|
// Indent multi-line strings (e.g. css).
|
||||||
if (state.tokenize.isInAttribute) {
|
if (state.tokenize.isInAttribute) {
|
||||||
if (state.tagStart == state.indented)
|
if (state.tagStart == state.indented)
|
||||||
return state.stringStartCol + 1;
|
return state.stringStartCol + 1;
|
||||||
else
|
else
|
||||||
return state.indented + indentUnit;
|
return state.indented + indentUnit;
|
||||||
}
|
}
|
||||||
if (context && context.noIndent) return CodeMirror.Pass;
|
if (context && context.noIndent) return CodeMirror.Pass;
|
||||||
if (state.tokenize != inTag && state.tokenize != inText)
|
if (state.tokenize != inTag && state.tokenize != inText)
|
||||||
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
||||||
// Indent the starts of attribute names.
|
// Indent the starts of attribute names.
|
||||||
if (state.tagName) {
|
if (state.tagName) {
|
||||||
if (multilineTagIndentPastTag)
|
if (multilineTagIndentPastTag)
|
||||||
return state.tagStart + state.tagName.length + 2;
|
return state.tagStart + state.tagName.length + 2;
|
||||||
else
|
else
|
||||||
return state.tagStart + indentUnit * multilineTagIndentFactor;
|
return state.tagStart + indentUnit * multilineTagIndentFactor;
|
||||||
}
|
}
|
||||||
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
||||||
var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
|
var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
|
||||||
if (tagAfter && tagAfter[1]) { // Closing tag spotted
|
if (tagAfter && tagAfter[1]) { // Closing tag spotted
|
||||||
while (context) {
|
while (context) {
|
||||||
if (context.tagName == tagAfter[2]) {
|
if (context.tagName == tagAfter[2]) {
|
||||||
context = context.prev;
|
context = context.prev;
|
||||||
break;
|
break;
|
||||||
} else if (Kludges.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
} else if (Kludges.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
||||||
context = context.prev;
|
context = context.prev;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (tagAfter) { // Opening tag spotted
|
} else if (tagAfter) { // Opening tag spotted
|
||||||
while (context) {
|
while (context) {
|
||||||
var grabbers = Kludges.contextGrabbers[context.tagName];
|
var grabbers = Kludges.contextGrabbers[context.tagName];
|
||||||
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
||||||
context = context.prev;
|
context = context.prev;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (context && !context.startOfLine)
|
while (context && !context.startOfLine)
|
||||||
context = context.prev;
|
context = context.prev;
|
||||||
if (context) return context.indent + indentUnit;
|
if (context) return context.indent + indentUnit;
|
||||||
else return 0;
|
else return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
electricInput: /<\/[\s\w:]+>$/,
|
electricInput: /<\/[\s\w:]+>$/,
|
||||||
blockCommentStart: "<!--",
|
blockCommentStart: "<!--",
|
||||||
blockCommentEnd: "-->",
|
blockCommentEnd: "-->",
|
||||||
|
|
||||||
configuration: parserConfig.htmlMode ? "html" : "xml",
|
configuration: parserConfig.htmlMode ? "html" : "xml",
|
||||||
helperType: parserConfig.htmlMode ? "html" : "xml"
|
helperType: parserConfig.htmlMode ? "html" : "xml"
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -382,4 +382,4 @@ CodeMirror.defineMIME("application/xml", "xml");
|
|||||||
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
||||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
1266
src/js/marked.js
1266
src/js/marked.js
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user