code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function getLines(doc, from, to) {
var out = [];
doc.iter(from, to, function(line) { out.push(line.text); });
return out;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getLines
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function updateLineHeight(line, height) {
var diff = height - line.height;
if (diff) for (var n = line; n; n = n.parent) n.height += diff;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
updateLineHeight
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineNo(line) {
if (line.parent == null) return null;
var cur = line.parent, no = indexOf(cur.lines, line);
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
for (var i = 0;; ++i) {
if (chunk.children[i] == cur) break;
no += chunk.children[i].chunkSize();
}
}
return no + cur.first;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineNo
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineAtHeight(chunk, h) {
var n = chunk.first;
outer: do {
for (var i = 0; i < chunk.children.length; ++i) {
var child = chunk.children[i], ch = child.height;
if (h < ch) { chunk = child; continue outer; }
h -= ch;
n += child.chunkSize();
}
return n;
} while (!chunk.lines);
for (var i = 0; i < chunk.lines.length; ++i) {
var line = chunk.lines[i], lh = line.height;
if (h < lh) break;
h -= lh;
}
return n + i;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineAtHeight
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function heightAtLine(lineObj) {
lineObj = visualLine(lineObj);
var h = 0, chunk = lineObj.parent;
for (var i = 0; i < chunk.lines.length; ++i) {
var line = chunk.lines[i];
if (line == lineObj) break;
else h += line.height;
}
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
for (var i = 0; i < p.children.length; ++i) {
var cur = p.children[i];
if (cur == chunk) break;
else h += cur.height;
}
}
return h;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
heightAtLine
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getOrder(line) {
var order = line.order;
if (order == null) order = line.order = bidiOrdering(line.text);
return order;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getOrder
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function History(startGen) {
// Arrays of change events and selections. Doing something adds an
// event to done and clears undo. Undoing moves events from done
// to undone, redoing moves them in the other direction.
this.done = []; this.undone = [];
this.undoDepth = Infinity;
// Used to track when changes can be merged into a single undo
// event
this.lastModTime = this.lastSelTime = 0;
this.lastOp = this.lastSelOp = null;
this.lastOrigin = this.lastSelOrigin = null;
// Used by the isClean() method
this.generation = this.maxGeneration = startGen || 1;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
History
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function historyChangeFromChange(doc, change) {
var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);
return histChange;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
historyChangeFromChange
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function clearSelectionEvents(array) {
while (array.length) {
var last = lst(array);
if (last.ranges) array.pop();
else break;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
clearSelectionEvents
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lastChangeEvent(hist, force) {
if (force) {
clearSelectionEvents(hist.done);
return lst(hist.done);
} else if (hist.done.length && !lst(hist.done).ranges) {
return lst(hist.done);
} else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
hist.done.pop();
return lst(hist.done);
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lastChangeEvent
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function addChangeToHistory(doc, change, selAfter, opId) {
var hist = doc.history;
hist.undone.length = 0;
var time = +new Date, cur;
if ((hist.lastOp == opId ||
hist.lastOrigin == change.origin && change.origin &&
((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
change.origin.charAt(0) == "*")) &&
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
// Merge this change into the last event
var last = lst(cur.changes);
if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
// Optimized case for simple insertion -- don't want to add
// new changesets for every character typed
last.to = changeEnd(change);
} else {
// Add new sub-event
cur.changes.push(historyChangeFromChange(doc, change));
}
} else {
// Can not be merged, start a new event.
var before = lst(hist.done);
if (!before || !before.ranges)
pushSelectionToHistory(doc.sel, hist.done);
cur = {changes: [historyChangeFromChange(doc, change)],
generation: hist.generation};
hist.done.push(cur);
while (hist.done.length > hist.undoDepth) {
hist.done.shift();
if (!hist.done[0].ranges) hist.done.shift();
}
}
hist.done.push(selAfter);
hist.generation = ++hist.maxGeneration;
hist.lastModTime = hist.lastSelTime = time;
hist.lastOp = hist.lastSelOp = opId;
hist.lastOrigin = hist.lastSelOrigin = change.origin;
if (!last) signal(doc, "historyAdded");
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
addChangeToHistory
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function selectionEventCanBeMerged(doc, origin, prev, sel) {
var ch = origin.charAt(0);
return ch == "*" ||
ch == "+" &&
prev.ranges.length == sel.ranges.length &&
prev.somethingSelected() == sel.somethingSelected() &&
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
selectionEventCanBeMerged
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function addSelectionToHistory(doc, sel, opId, options) {
var hist = doc.history, origin = options && options.origin;
// A new event is started when the previous origin does not match
// the current, or the origins don't allow matching. Origins
// starting with * are always merged, those starting with + are
// merged when similar and close together in time.
if (opId == hist.lastSelOp ||
(origin && hist.lastSelOrigin == origin &&
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
hist.done[hist.done.length - 1] = sel;
else
pushSelectionToHistory(sel, hist.done);
hist.lastSelTime = +new Date;
hist.lastSelOrigin = origin;
hist.lastSelOp = opId;
if (options && options.clearRedo !== false)
clearSelectionEvents(hist.undone);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
addSelectionToHistory
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function pushSelectionToHistory(sel, dest) {
var top = lst(dest);
if (!(top && top.ranges && top.equals(sel)))
dest.push(sel);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
pushSelectionToHistory
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function attachLocalSpans(doc, change, from, to) {
var existing = change["spans_" + doc.id], n = 0;
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
if (line.markedSpans)
(existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
++n;
});
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
attachLocalSpans
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function removeClearedSpans(spans) {
if (!spans) return null;
for (var i = 0, out; i < spans.length; ++i) {
if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
else if (out) out.push(spans[i]);
}
return !out ? spans : out.length ? out : null;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
removeClearedSpans
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getOldSpans(doc, change) {
var found = change["spans_" + doc.id];
if (!found) return null;
for (var i = 0, nw = []; i < change.text.length; ++i)
nw.push(removeClearedSpans(found[i]));
return nw;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getOldSpans
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function copyHistoryArray(events, newGroup, instantiateSel) {
for (var i = 0, copy = []; i < events.length; ++i) {
var event = events[i];
if (event.ranges) {
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
continue;
}
var changes = event.changes, newChanges = [];
copy.push({changes: newChanges});
for (var j = 0; j < changes.length; ++j) {
var change = changes[j], m;
newChanges.push({from: change.from, to: change.to, text: change.text});
if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
if (indexOf(newGroup, Number(m[1])) > -1) {
lst(newChanges)[prop] = change[prop];
delete change[prop];
}
}
}
}
return copy;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
copyHistoryArray
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function rebaseHistSelSingle(pos, from, to, diff) {
if (to < pos.line) {
pos.line += diff;
} else if (from < pos.line) {
pos.line = from;
pos.ch = 0;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
rebaseHistSelSingle
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function rebaseHistArray(array, from, to, diff) {
for (var i = 0; i < array.length; ++i) {
var sub = array[i], ok = true;
if (sub.ranges) {
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
for (var j = 0; j < sub.ranges.length; j++) {
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
}
continue;
}
for (var j = 0; j < sub.changes.length; ++j) {
var cur = sub.changes[j];
if (to < cur.from.line) {
cur.from = Pos(cur.from.line + diff, cur.from.ch);
cur.to = Pos(cur.to.line + diff, cur.to.ch);
} else if (from <= cur.to.line) {
ok = false;
break;
}
}
if (!ok) {
array.splice(0, i + 1);
i = 0;
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
rebaseHistArray
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function rebaseHist(hist, change) {
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
rebaseHistArray(hist.done, from, to, diff);
rebaseHistArray(hist.undone, from, to, diff);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
rebaseHist
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function e_defaultPrevented(e) {
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
e_defaultPrevented
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function e_button(e) {
var b = e.which;
if (b == null) {
if (e.button & 1) b = 1;
else if (e.button & 2) b = 3;
else if (e.button & 4) b = 2;
}
if (mac && e.ctrlKey && b == 1) b = 3;
return b;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
e_button
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getHandlers(emitter, type, copy) {
var arr = emitter._handlers && emitter._handlers[type]
if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers
else return arr || noHandlers
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getHandlers
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function signalLater(emitter, type /*, values...*/) {
var arr = getHandlers(emitter, type, false)
if (!arr.length) return;
var args = Array.prototype.slice.call(arguments, 2), list;
if (operationGroup) {
list = operationGroup.delayedCallbacks;
} else if (orphanDelayedCallbacks) {
list = orphanDelayedCallbacks;
} else {
list = orphanDelayedCallbacks = [];
setTimeout(fireOrphanDelayed, 0);
}
function bnd(f) {return function(){f.apply(null, args);};};
for (var i = 0; i < arr.length; ++i)
list.push(bnd(arr[i]));
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
signalLater
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function fireOrphanDelayed() {
var delayed = orphanDelayedCallbacks;
orphanDelayedCallbacks = null;
for (var i = 0; i < delayed.length; ++i) delayed[i]();
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fireOrphanDelayed
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function signalDOMEvent(cm, e, override) {
if (typeof e == "string")
e = {type: e, preventDefault: function() { this.defaultPrevented = true; }};
signal(cm, override || e.type, cm, e);
return e_defaultPrevented(e) || e.codemirrorIgnore;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
signalDOMEvent
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function signalCursorActivity(cm) {
var arr = cm._handlers && cm._handlers.cursorActivity;
if (!arr) return;
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)
set.push(arr[i]);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
signalCursorActivity
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function hasHandler(emitter, type) {
return getHandlers(emitter, type).length > 0
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hasHandler
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function eventMixin(ctor) {
ctor.prototype.on = function(type, f) {on(this, type, f);};
ctor.prototype.off = function(type, f) {off(this, type, f);};
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
eventMixin
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function spaceStr(n) {
while (spaceStrs.length <= n)
spaceStrs.push(lst(spaceStrs) + " ");
return spaceStrs[n];
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
spaceStr
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function indexOf(array, elt) {
for (var i = 0; i < array.length; ++i)
if (array[i] == elt) return i;
return -1;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
indexOf
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function map(array, f) {
var out = [];
for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);
return out;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
map
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function createObj(base, props) {
var inst;
if (Object.create) {
inst = Object.create(base);
} else {
nothing.prototype = base;
inst = new nothing();
}
if (props) copyObj(props, inst);
return inst;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
createObj
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function copyObj(obj, target, overwrite) {
if (!target) target = {};
for (var prop in obj)
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
target[prop] = obj[prop];
return target;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
copyObj
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function bind(f) {
var args = Array.prototype.slice.call(arguments, 1);
return function(){return f.apply(null, args);};
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
bind
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function isWordChar(ch, helper) {
if (!helper) return isWordCharBasic(ch);
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true;
return helper.test(ch);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isWordChar
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function isEmpty(obj) {
for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;
return true;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isEmpty
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function elt(tag, content, className, style) {
var e = document.createElement(tag);
if (className) e.className = className;
if (style) e.style.cssText = style;
if (typeof content == "string") e.appendChild(document.createTextNode(content));
else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
return e;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
elt
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function removeChildren(e) {
for (var count = e.childNodes.length; count > 0; --count)
e.removeChild(e.firstChild);
return e;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
removeChildren
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function removeChildrenAndAdd(parent, e) {
return removeChildren(parent).appendChild(e);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
removeChildrenAndAdd
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function activeElt() {
var activeElement = document.activeElement;
while (activeElement && activeElement.root && activeElement.root.activeElement)
activeElement = activeElement.root.activeElement;
return activeElement;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
activeElt
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function joinClasses(a, b) {
var as = a.split(" ");
for (var i = 0; i < as.length; i++)
if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i];
return b;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
joinClasses
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function forEachCodeMirror(f) {
if (!document.body.getElementsByClassName) return;
var byClass = document.body.getElementsByClassName("CodeMirror");
for (var i = 0; i < byClass.length; i++) {
var cm = byClass[i].CodeMirror;
if (cm) f(cm);
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
forEachCodeMirror
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function ensureGlobalHandlers() {
if (globalsRegistered) return;
registerGlobalHandlers();
globalsRegistered = true;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
ensureGlobalHandlers
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function registerGlobalHandlers() {
// When the window resizes, we need to refresh active editors.
var resizeTimer;
on(window, "resize", function() {
if (resizeTimer == null) resizeTimer = setTimeout(function() {
resizeTimer = null;
forEachCodeMirror(onResize);
}, 100);
});
// When the window loses focus, we want to show the editor as blurred
on(window, "blur", function() {
forEachCodeMirror(onBlur);
});
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
registerGlobalHandlers
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function zeroWidthElement(measure) {
if (zwspSupported == null) {
var test = elt("span", "\u200b");
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
if (measure.firstChild.offsetHeight != 0)
zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);
}
var node = zwspSupported ? elt("span", "\u200b") :
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
node.setAttribute("cm-text", "");
return node;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
zeroWidthElement
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function hasBadBidiRects(measure) {
if (badBidiRects != null) return badBidiRects;
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
var r0 = range(txt, 0, 1).getBoundingClientRect();
if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)
var r1 = range(txt, 1, 2).getBoundingClientRect();
return badBidiRects = (r1.right - r0.right < 3);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hasBadBidiRects
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function hasBadZoomedRects(measure) {
if (badZoomedRects != null) return badZoomedRects;
var node = removeChildrenAndAdd(measure, elt("span", "x"));
var normal = node.getBoundingClientRect();
var fromRange = range(node, 0, 1).getBoundingClientRect();
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hasBadZoomedRects
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function iterateBidiSections(order, from, to, f) {
if (!order) return f(from, to, "ltr");
var found = false;
for (var i = 0; i < order.length; ++i) {
var part = order[i];
if (part.from < to && part.to > from || from == to && part.to == from) {
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
found = true;
}
}
if (!found) f(from, to, "ltr");
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
iterateBidiSections
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineRight(line) {
var order = getOrder(line);
if (!order) return line.text.length;
return bidiRight(lst(order));
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineRight
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineStart(cm, lineN) {
var line = getLine(cm.doc, lineN);
var visual = visualLine(line);
if (visual != line) lineN = lineNo(visual);
var order = getOrder(visual);
var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
return Pos(lineN, ch);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineStart
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineEnd(cm, lineN) {
var merged, line = getLine(cm.doc, lineN);
while (merged = collapsedSpanAtEnd(line)) {
line = merged.find(1, true).line;
lineN = null;
}
var order = getOrder(line);
var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
return Pos(lineN == null ? lineNo(line) : lineN, ch);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineEnd
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineStartSmart(cm, pos) {
var start = lineStart(cm, pos.line);
var line = getLine(cm.doc, start.line);
var order = getOrder(line);
if (!order || order[0].level == 0) {
var firstNonWS = Math.max(0, line.text.search(/\S/));
var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
return Pos(start.line, inWS ? 0 : firstNonWS);
}
return start;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineStartSmart
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function compareBidiLevel(order, a, b) {
var linedir = order[0].level;
if (a == linedir) return true;
if (b == linedir) return false;
return a < b;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
compareBidiLevel
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getBidiPartAt(order, pos) {
bidiOther = null;
for (var i = 0, found; i < order.length; ++i) {
var cur = order[i];
if (cur.from < pos && cur.to > pos) return i;
if ((cur.from == pos || cur.to == pos)) {
if (found == null) {
found = i;
} else if (compareBidiLevel(order, cur.level, order[found].level)) {
if (cur.from != cur.to) bidiOther = found;
return i;
} else {
if (cur.from != cur.to) bidiOther = i;
return found;
}
}
}
return found;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getBidiPartAt
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function moveInLine(line, pos, dir, byUnit) {
if (!byUnit) return pos + dir;
do pos += dir;
while (pos > 0 && isExtendingChar(line.text.charAt(pos)));
return pos;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
moveInLine
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function moveVisually(line, start, dir, byUnit) {
var bidi = getOrder(line);
if (!bidi) return moveLogically(line, start, dir, byUnit);
var pos = getBidiPartAt(bidi, start), part = bidi[pos];
var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);
for (;;) {
if (target > part.from && target < part.to) return target;
if (target == part.from || target == part.to) {
if (getBidiPartAt(bidi, target) == pos) return target;
part = bidi[pos += dir];
return (dir > 0) == part.level % 2 ? part.to : part.from;
} else {
part = bidi[pos += dir];
if (!part) return null;
if ((dir > 0) == part.level % 2)
target = moveInLine(line, part.to, -1, byUnit);
else
target = moveInLine(line, part.from, 1, byUnit);
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
moveVisually
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function moveLogically(line, start, dir, byUnit) {
var target = start + dir;
if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;
return target < 0 || target > line.text.length ? null : target;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
moveLogically
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function charType(code) {
if (code <= 0xf7) return lowTypes.charAt(code);
else if (0x590 <= code && code <= 0x5f4) return "R";
else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);
else if (0x6ee <= code && code <= 0x8ac) return "r";
else if (0x2000 <= code && code <= 0x200b) return "w";
else if (code == 0x200c) return "b";
else return "L";
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
charType
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function BidiSpan(level, from, to) {
this.level = level;
this.from = from; this.to = to;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
BidiSpan
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function blankLine(state) {
state.code = false;
return null;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
blankLine
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getMode(name) {
if (CodeMirror.findModeByName) {
var found = CodeMirror.findModeByName(name);
if (found) name = found.mime || found.mimes[0];
}
var mode = CodeMirror.getMode(cmCfg, name);
return mode.name == "null" ? null : mode;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getMode
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function switchInline(stream, state, f) {
state.f = state.inline = f;
return f(stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
switchInline
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function switchBlock(stream, state, f) {
state.f = state.block = f;
return f(stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
switchBlock
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function lineIsEmpty(line) {
return !line || !/\S/.test(line.string)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
lineIsEmpty
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function blankLine(state) {
// Reset linkTitle state
state.linkTitle = false;
// Reset EM state
state.em = false;
// Reset STRONG state
state.strong = false;
// Reset strikethrough state
state.strikethrough = false;
// Reset state.quote
state.quote = 0;
// Reset state.indentedCode
state.indentedCode = false;
if (htmlModeMissing && state.f == htmlBlock) {
state.f = inlineNormal;
state.block = blockNormal;
}
// Reset state.trailingSpace
state.trailingSpace = 0;
state.trailingSpaceNewLine = false;
// Mark this line as blank
state.prevLine = state.thisLine
state.thisLine = null
return null;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
blankLine
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function blockNormal(stream, state) {
var sol = stream.sol();
var prevLineIsList = state.list !== false,
prevLineIsIndentedCode = state.indentedCode;
state.indentedCode = false;
if (prevLineIsList) {
if (state.indentationDiff >= 0) { // Continued list
if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
state.indentation -= state.indentationDiff;
}
state.list = null;
} else if (state.indentation > 0) {
state.list = null;
} else { // No longer a list
state.list = false;
}
}
var match = null;
if (state.indentationDiff >= 4) {
stream.skipToEnd();
if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
state.indentation -= 4;
state.indentedCode = true;
return tokenTypes.code;
} else {
return null;
}
} else if (stream.eatSpace()) {
return null;
} else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
state.header = match[1].length;
if (modeCfg.highlightFormatting) state.formatting = "header";
state.f = state.inline;
return getType(state);
} else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&
!prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
state.header = match[0].charAt(0) == '=' ? 1 : 2;
if (modeCfg.highlightFormatting) state.formatting = "header";
state.f = state.inline;
return getType(state);
} else if (stream.eat('>')) {
state.quote = sol ? 1 : state.quote + 1;
if (modeCfg.highlightFormatting) state.formatting = "quote";
stream.eatSpace();
return getType(state);
} else if (stream.peek() === '[') {
return switchInline(stream, state, footnoteLink);
} else if (stream.match(hrRE, true)) {
state.hr = true;
return tokenTypes.hr;
} else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
var listType = null;
if (stream.match(ulRE, true)) {
listType = 'ul';
} else {
stream.match(olRE, true);
listType = 'ol';
}
state.indentation = stream.column() + stream.current().length;
state.list = true;
// While this list item's marker's indentation
// is less than the deepest list item's content's indentation,
// pop the deepest list item indentation off the stack.
while (state.listStack && stream.column() < state.listStack[state.listStack.length - 1]) {
state.listStack.pop();
}
// Add this list item's content's indentation to the stack
state.listStack.push(state.indentation);
if (modeCfg.taskLists && stream.match(taskListRE, false)) {
state.taskList = true;
}
state.f = state.inline;
if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
return getType(state);
} else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {
state.fencedChars = match[1]
// try switching mode
state.localMode = getMode(match[2]);
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
state.f = state.block = local;
if (modeCfg.highlightFormatting) state.formatting = "code-block";
state.code = -1
return getType(state);
}
return switchInline(stream, state, state.inline);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
blockNormal
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function htmlBlock(stream, state) {
var style = htmlMode.token(stream, state.htmlState);
if (!htmlModeMissing) {
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
(!inner.state.context && inner.state.tokenize.isInText)) ||
(state.md_inside && stream.current().indexOf(">") > -1)) {
state.f = inlineNormal;
state.block = blockNormal;
state.htmlState = null;
}
}
return style;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
htmlBlock
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function local(stream, state) {
if (state.fencedChars && stream.match(state.fencedChars, false)) {
state.localMode = state.localState = null;
state.f = state.block = leavingLocal;
return null;
} else if (state.localMode) {
return state.localMode.token(stream, state.localState);
} else {
stream.skipToEnd();
return tokenTypes.code;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
local
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function leavingLocal(stream, state) {
stream.match(state.fencedChars);
state.block = blockNormal;
state.f = inlineNormal;
state.fencedChars = null;
if (modeCfg.highlightFormatting) state.formatting = "code-block";
state.code = 1
var returnType = getType(state);
state.code = 0
return returnType;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
leavingLocal
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getType(state) {
var styles = [];
if (state.formatting) {
styles.push(tokenTypes.formatting);
if (typeof state.formatting === "string") state.formatting = [state.formatting];
for (var i = 0; i < state.formatting.length; i++) {
styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
if (state.formatting[i] === "header") {
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
}
// Add `formatting-quote` and `formatting-quote-#` for blockquotes
// Add `error` instead if the maximum blockquote nesting depth is passed
if (state.formatting[i] === "quote") {
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
} else {
styles.push("error");
}
}
}
}
if (state.taskOpen) {
styles.push("meta");
return styles.length ? styles.join(' ') : null;
}
if (state.taskClosed) {
styles.push("property");
return styles.length ? styles.join(' ') : null;
}
if (state.linkHref) {
styles.push(tokenTypes.linkHref, "url");
} else { // Only apply inline styles to non-url text
if (state.strong) { styles.push(tokenTypes.strong); }
if (state.em) { styles.push(tokenTypes.em); }
if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
if (state.linkText) { styles.push(tokenTypes.linkText); }
if (state.code) { styles.push(tokenTypes.code); }
}
if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
if (state.quote) {
styles.push(tokenTypes.quote);
// Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
styles.push(tokenTypes.quote + "-" + state.quote);
} else {
styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
}
}
if (state.list !== false) {
var listMod = (state.listStack.length - 1) % 3;
if (!listMod) {
styles.push(tokenTypes.list1);
} else if (listMod === 1) {
styles.push(tokenTypes.list2);
} else {
styles.push(tokenTypes.list3);
}
}
if (state.trailingSpaceNewLine) {
styles.push("trailing-space-new-line");
} else if (state.trailingSpace) {
styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
}
return styles.length ? styles.join(' ') : null;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getType
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function handleText(stream, state) {
if (stream.match(textRE, true)) {
return getType(state);
}
return undefined;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
handleText
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function inlineNormal(stream, state) {
var style = state.text(stream, state);
if (typeof style !== 'undefined')
return style;
if (state.list) { // List marker (*, +, -, 1., etc)
state.list = null;
return getType(state);
}
if (state.taskList) {
var taskOpen = stream.match(taskListRE, true)[1] !== "x";
if (taskOpen) state.taskOpen = true;
else state.taskClosed = true;
if (modeCfg.highlightFormatting) state.formatting = "task";
state.taskList = false;
return getType(state);
}
state.taskOpen = false;
state.taskClosed = false;
if (state.header && stream.match(/^#+$/, true)) {
if (modeCfg.highlightFormatting) state.formatting = "header";
return getType(state);
}
// Get sol() value now, before character is consumed
var sol = stream.sol();
var ch = stream.next();
// Matches link titles present on next line
if (state.linkTitle) {
state.linkTitle = false;
var matchCh = ch;
if (ch === '(') {
matchCh = ')';
}
matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
if (stream.match(new RegExp(regex), true)) {
return tokenTypes.linkHref;
}
}
// If this block is changed, it may need to be updated in GFM mode
if (ch === '`') {
var previousFormatting = state.formatting;
if (modeCfg.highlightFormatting) state.formatting = "code";
stream.eatWhile('`');
var count = stream.current().length
if (state.code == 0) {
state.code = count
return getType(state)
} else if (count == state.code) { // Must be exact
var t = getType(state)
state.code = 0
return t
} else {
state.formatting = previousFormatting
return getType(state)
}
} else if (state.code) {
return getType(state);
}
if (ch === '\\') {
stream.next();
if (modeCfg.highlightFormatting) {
var type = getType(state);
var formattingEscape = tokenTypes.formatting + "-escape";
return type ? type + " " + formattingEscape : formattingEscape;
}
}
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
stream.match(/\[[^\]]*\]/);
state.inline = state.f = linkHref;
return tokenTypes.image;
}
if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false)) {
state.linkText = true;
if (modeCfg.highlightFormatting) state.formatting = "link";
return getType(state);
}
if (ch === ']' && state.linkText && stream.match(/\(.*?\)| ?\[.*?\]/, false)) {
if (modeCfg.highlightFormatting) state.formatting = "link";
var type = getType(state);
state.linkText = false;
state.inline = state.f = linkHref;
return type;
}
if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
state.f = state.inline = linkInline;
if (modeCfg.highlightFormatting) state.formatting = "link";
var type = getType(state);
if (type){
type += " ";
} else {
type = "";
}
return type + tokenTypes.linkInline;
}
if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
state.f = state.inline = linkInline;
if (modeCfg.highlightFormatting) state.formatting = "link";
var type = getType(state);
if (type){
type += " ";
} else {
type = "";
}
return type + tokenTypes.linkEmail;
}
if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
var end = stream.string.indexOf(">", stream.pos);
if (end != -1) {
var atts = stream.string.substring(stream.start, end);
if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
}
stream.backUp(1);
state.htmlState = CodeMirror.startState(htmlMode);
return switchBlock(stream, state, htmlBlock);
}
if (ch === '<' && stream.match(/^\/\w*?>/)) {
state.md_inside = false;
return "tag";
}
var ignoreUnderscore = false;
if (!modeCfg.underscoresBreakWords) {
if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
var prevPos = stream.pos - 2;
if (prevPos >= 0) {
var prevCh = stream.string.charAt(prevPos);
if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
ignoreUnderscore = true;
}
}
}
}
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";
var t = getType(state);
state.strong = false;
return t;
} else if (!state.strong && stream.eat(ch)) { // Add STRONG
state.strong = ch;
if (modeCfg.highlightFormatting) state.formatting = "strong";
return getType(state);
} else if (state.em === ch) { // Remove EM
if (modeCfg.highlightFormatting) state.formatting = "em";
var t = getType(state);
state.em = false;
return t;
} else if (!state.em) { // Add EM
state.em = ch;
if (modeCfg.highlightFormatting) state.formatting = "em";
return getType(state);
}
} else if (ch === ' ') {
if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
return getType(state);
} else { // Not surrounded by spaces, back up pointer
stream.backUp(1);
}
}
}
if (modeCfg.strikethrough) {
if (ch === '~' && stream.eatWhile(ch)) {
if (state.strikethrough) {// Remove strikethrough
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
var t = getType(state);
state.strikethrough = false;
return t;
} else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
state.strikethrough = true;
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
return getType(state);
}
} else if (ch === ' ') {
if (stream.match(/^~~/, true)) { // Probably surrounded by space
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
return getType(state);
} else { // Not surrounded by spaces, back up pointer
stream.backUp(2);
}
}
}
}
if (ch === ' ') {
if (stream.match(/ +$/, false)) {
state.trailingSpace++;
} else if (state.trailingSpace) {
state.trailingSpaceNewLine = true;
}
}
return getType(state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
inlineNormal
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function linkInline(stream, state) {
var ch = stream.next();
if (ch === ">") {
state.f = state.inline = inlineNormal;
if (modeCfg.highlightFormatting) state.formatting = "link";
var type = getType(state);
if (type){
type += " ";
} else {
type = "";
}
return type + tokenTypes.linkInline;
}
stream.match(/^[^>]+/, true);
return tokenTypes.linkInline;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
linkInline
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function linkHref(stream, state) {
// Check if space, and return NULL if so (to avoid marking the space)
if(stream.eatSpace()){
return null;
}
var ch = stream.next();
if (ch === '(' || ch === '[') {
state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]", 0);
if (modeCfg.highlightFormatting) state.formatting = "link-string";
state.linkHref = true;
return getType(state);
}
return 'error';
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
linkHref
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function getLinkHrefInside(endChar) {
return function(stream, state) {
var ch = stream.next();
if (ch === endChar) {
state.f = state.inline = inlineNormal;
if (modeCfg.highlightFormatting) state.formatting = "link-string";
var returnState = getType(state);
state.linkHref = false;
return returnState;
}
stream.match(linkRE[endChar])
state.linkHref = true;
return getType(state);
};
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getLinkHrefInside
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function footnoteLink(stream, state) {
if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
state.f = footnoteLinkInside;
stream.next(); // Consume [
if (modeCfg.highlightFormatting) state.formatting = "link";
state.linkText = true;
return getType(state);
}
return switchInline(stream, state, inlineNormal);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
footnoteLink
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function footnoteLinkInside(stream, state) {
if (stream.match(/^\]:/, true)) {
state.f = state.inline = footnoteUrl;
if (modeCfg.highlightFormatting) state.formatting = "link";
var returnType = getType(state);
state.linkText = false;
return returnType;
}
stream.match(/^([^\]\\]|\\.)+/, true);
return tokenTypes.linkText;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
footnoteLinkInside
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function footnoteUrl(stream, state) {
// Check if space, and return NULL if so (to avoid marking the space)
if(stream.eatSpace()){
return null;
}
// Match URL
stream.match(/^[^\s]+/, true);
// Check for link title
if (stream.peek() === undefined) { // End of line, set flag to check next line
state.linkTitle = true;
} else { // More content on line, check if link title
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
}
state.f = state.inline = inlineNormal;
return tokenTypes.linkHref + " url";
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
footnoteUrl
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function inText(stream, state) {
function chain(parser) {
state.tokenize = parser;
return parser(stream, state);
}
var ch = stream.next();
if (ch == "<") {
if (stream.eat("!")) {
if (stream.eat("[")) {
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
else return null;
} else if (stream.match("--")) {
return chain(inBlock("comment", "-->"));
} else if (stream.match("DOCTYPE", true, true)) {
stream.eatWhile(/[\w\._\-]/);
return chain(doctype(1));
} else {
return null;
}
} else if (stream.eat("?")) {
stream.eatWhile(/[\w\._\-]/);
state.tokenize = inBlock("meta", "?>");
return "meta";
} else {
type = stream.eat("/") ? "closeTag" : "openTag";
state.tokenize = inTag;
return "tag bracket";
}
} else if (ch == "&") {
var ok;
if (stream.eat("#")) {
if (stream.eat("x")) {
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
} else {
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
}
} else {
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
}
return ok ? "atom" : "error";
} else {
stream.eatWhile(/[^&<]/);
return null;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
inText
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function chain(parser) {
state.tokenize = parser;
return parser(stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
chain
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function inTag(stream, state) {
var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.tokenize = inText;
type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag bracket";
} else if (ch == "=") {
type = "equals";
return null;
} else if (ch == "<") {
state.tokenize = inText;
state.state = baseState;
state.tagName = state.tagStart = null;
var next = state.tokenize(stream, state);
return next ? next + " tag error" : "tag error";
} else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
state.stringStartCol = stream.column();
return state.tokenize(stream, state);
} else {
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
return "word";
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
inTag
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function inAttribute(quote) {
var closure = function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
return "string";
};
closure.isInAttribute = true;
return closure;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
inAttribute
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
closure = function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
return "string";
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
closure
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function inBlock(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
state.tokenize = inText;
break;
}
stream.next();
}
return style;
};
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
inBlock
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function doctype(depth) {
return function(stream, state) {
var ch;
while ((ch = stream.next()) != null) {
if (ch == "<") {
state.tokenize = doctype(depth + 1);
return state.tokenize(stream, state);
} else if (ch == ">") {
if (depth == 1) {
state.tokenize = inText;
break;
} else {
state.tokenize = doctype(depth - 1);
return state.tokenize(stream, state);
}
}
}
return "meta";
};
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
doctype
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function Context(state, tagName, startOfLine) {
this.prev = state.context;
this.tagName = tagName;
this.indent = state.indented;
this.startOfLine = startOfLine;
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
this.noIndent = true;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
Context
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function popContext(state) {
if (state.context) state.context = state.context.prev;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
popContext
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function maybePopContext(state, nextTagName) {
var parentTagName;
while (true) {
if (!state.context) {
return;
}
parentTagName = state.context.tagName;
if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
return;
}
popContext(state);
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
maybePopContext
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function baseState(type, stream, state) {
if (type == "openTag") {
state.tagStart = stream.column();
return tagNameState;
} else if (type == "closeTag") {
return closeTagNameState;
} else {
return baseState;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
baseState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function tagNameState(type, stream, state) {
if (type == "word") {
state.tagName = stream.current();
setStyle = "tag";
return attrState;
} else {
setStyle = "error";
return tagNameState;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
tagNameState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function closeTagNameState(type, stream, state) {
if (type == "word") {
var tagName = stream.current();
if (state.context && state.context.tagName != tagName &&
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
popContext(state);
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
setStyle = "tag";
return closeState;
} else {
setStyle = "tag error";
return closeStateErr;
}
} else {
setStyle = "error";
return closeStateErr;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
closeTagNameState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function closeState(type, _stream, state) {
if (type != "endTag") {
setStyle = "error";
return closeState;
}
popContext(state);
return baseState;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
closeState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function closeStateErr(type, stream, state) {
setStyle = "error";
return closeState(type, stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
closeStateErr
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function attrState(type, _stream, state) {
if (type == "word") {
setStyle = "attribute";
return attrEqState;
} else if (type == "endTag" || type == "selfcloseTag") {
var tagName = state.tagName, tagStart = state.tagStart;
state.tagName = state.tagStart = null;
if (type == "selfcloseTag" ||
config.autoSelfClosers.hasOwnProperty(tagName)) {
maybePopContext(state, tagName);
} else {
maybePopContext(state, tagName);
state.context = new Context(state, tagName, tagStart == state.indented);
}
return baseState;
}
setStyle = "error";
return attrState;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
attrState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function attrEqState(type, stream, state) {
if (type == "equals") return attrValueState;
if (!config.allowMissing) setStyle = "error";
return attrState(type, stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
attrEqState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function attrValueState(type, stream, state) {
if (type == "string") return attrContinuedState;
if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
setStyle = "error";
return attrState(type, stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
attrValueState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function attrContinuedState(type, stream, state) {
if (type == "string") return attrContinuedState;
return attrState(type, stream, state);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
attrContinuedState
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
function addWord(word, rules) {
// Some dictionaries will list the same word multiple times with different rule sets.
if (!(word in dictionaryTable) || typeof dictionaryTable[word] != 'object') {
dictionaryTable[word] = [];
}
dictionaryTable[word].push(rules);
}
|
Parses the words out from the .dic file.
@param {String} data The data from the dictionary file.
@returns object The lookup table containing all of the words and
word forms from the dictionary.
|
addWord
|
javascript
|
sparksuite/simplemde-markdown-editor
|
debug/simplemde.debug.js
|
https://github.com/sparksuite/simplemde-markdown-editor/blob/master/debug/simplemde.debug.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.