{ "tiddlers": { "$:/config/codemirror/autocomplete": { "title": "$:/config/codemirror/autocomplete", "text": "{\n\t\"Ctrl-Space\": \"autocomplete\"\n}", "type": "json", "created": "20210328004023360", "extend": "extraKeys", "modified": "20210328004023360" }, "$:/plugins/tiddlywiki/codemirror/addon/hint/anyword-hint.js": { "title": "$:/plugins/tiddlywiki/codemirror/addon/hint/anyword-hint.js", "text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function (mod) {\n\tif (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n\t\tmod(require(\"../../lib/codemirror\"));\n\telse if (typeof define == \"function\" && define.amd) // AMD\n\t\tdefine([\"../../lib/codemirror\"], mod);\n\telse // Plain browser env\n\t\tmod(CodeMirror);\n})(function (CodeMirror) {\n\t\"use strict\";\n\n\tCodeMirror.registerHelper('hint', 'anyword', function (editor) {\n\t\tvar cur = editor.getCursor();\n\t\tvar curLine = editor.getLine(cur.line);\n\t\tvar start = cur.ch;\n\t\tvar end = start;\n\t\tvar max_length = 30\n\n\t\tvar escapeChars = ['.', ']', '}', '>']\n\t\tvar stopChars = ['[', '{', '|', '\"']\n\n\t\twhile (start) {\n\t\t\tvar ch = curLine.charAt(start - 1)\n\t\t\tif (end - start > max_length || escapeChars.includes(ch)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tif (!(stopChars.includes(ch))) {\n\t\t\t\tstart--;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar curWord = start !== end && curLine.slice(start, end);\n\t\tif (curLine.charAt(start) == '$') {\n\t\t\treturn {\n\t\t\t\tlist: $tw.wiki.filterTiddlers(`[all[tiddlers]search:title:literal[${curWord}]!prefix[$:/state]]`),\n\t\t\t\tfrom: CodeMirror.Pos(cur.line, start),\n\t\t\t\tto: CodeMirror.Pos(cur.line, end)\n\t\t\t}\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tlist: $tw.wiki.filterTiddlers(`[all[tiddlers]!is[system]!is[shadow]search:title:literal[${curWord}]!prefix[$:/state]]`),\n\t\t\t\tfrom: CodeMirror.Pos(cur.line, start),\n\t\t\t\tto: CodeMirror.Pos(cur.line, end)\n\t\t\t}\n\t\t}\n\t})\n});", "created": "20210328004232522", "modified": "20210328010801763", "module-type": "codemirror", "type": "application/javascript" }, "$:/plugins/tiddlywiki/codemirror/addon/hint/show-hint.css": { "title": "$:/plugins/tiddlywiki/codemirror/addon/hint/show-hint.css", "text": ".CodeMirror-hints {\n position: absolute;\n z-index: 10;\n overflow: hidden;\n list-style: none;\n\n margin: 0;\n padding: 2px;\n\n -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n border-radius: 3px;\n border: 1px solid silver;\n\n background: white;\n font-size: 90%;\n font-family: monospace;\n\n max-height: 20em;\n overflow-y: auto;\n}\n\n.CodeMirror-hint {\n margin: 0;\n padding: 0 4px;\n border-radius: 2px;\n white-space: pre;\n color: black;\n cursor: pointer;\n}\n\nli.CodeMirror-hint-active {\n background: #08f;\n color: white;\n}\n", "created": "20210328012141944", "modified": "20210328012141944", "tags": "$:/tags/Stylesheet", "type": "text/css" }, "$:/plugins/tiddlywiki/codemirror/addon/hint/show-hint.js": { "title": "$:/plugins/tiddlywiki/codemirror/addon/hint/show-hint.js", "text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n! function (t) {\n \"object\" == typeof exports && \"object\" == typeof module ? t(require(\"../../lib/codemirror\")) : \"function\" == typeof define && define.amd ? define([\"../../lib/codemirror\"], t) : t(CodeMirror)\n}(function (W) {\n \"use strict\";\n var I = \"CodeMirror-hint-active\";\n\n function o(t, i) {\n this.cm = t, this.options = i, this.widget = null, this.debounce = 0, this.tick = 0, this.startPos = this.cm.getCursor(\"start\"), this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;\n var e = this;\n t.on(\"cursorActivity\", this.activityFunc = function () {\n e.cursorActivity()\n })\n }\n W.showHint = function (t, i, e) {\n if (!i) return t.showHint(e);\n e && e.async && (i.async = !0);\n var n = {\n hint: i\n };\n if (e)\n for (var o in e) n[o] = e[o];\n return t.showHint(n)\n }, W.defineExtension(\"showHint\", function (t) {\n t = function (t, i, e) {\n var n = t.options.hintOptions,\n o = {};\n for (var s in l) o[s] = l[s];\n if (n)\n for (var s in n) void 0 !== n[s] && (o[s] = n[s]);\n if (e)\n for (var s in e) void 0 !== e[s] && (o[s] = e[s]);\n o.hint.resolve && (o.hint = o.hint.resolve(t, i));\n return o\n }(this, this.getCursor(\"start\"), t);\n var i = this.listSelections();\n if (!(1 < i.length)) {\n if (this.somethingSelected()) {\n if (!t.hint.supportsSelection) return;\n for (var e = 0; e < i.length; e++)\n if (i[e].head.line != i[e].anchor.line) return\n }\n this.state.completionActive && this.state.completionActive.close();\n var n = this.state.completionActive = new o(this, t);\n n.options.hint && (W.signal(this, \"startCompletion\", this), n.update(!0))\n }\n }), W.defineExtension(\"closeHint\", function () {\n this.state.completionActive && this.state.completionActive.close()\n });\n var s = window.requestAnimationFrame || function (t) {\n return setTimeout(t, 1e3 / 60)\n },\n c = window.cancelAnimationFrame || clearTimeout;\n\n function B(t) {\n return \"string\" == typeof t ? t : t.text\n }\n\n function K(t, i) {\n for (; i && i != t;) {\n if (\"LI\" === i.nodeName.toUpperCase() && i.parentNode == t) return i;\n i = i.parentNode\n }\n }\n\n function n(o, t) {\n this.completion = o, this.data = t, this.picked = !1;\n var e = this,\n s = o.cm,\n c = s.getInputField().ownerDocument,\n r = c.defaultView || c.parentWindow,\n l = this.hints = c.createElement(\"ul\"),\n i = o.cm.options.theme;\n l.className = \"CodeMirror-hints \" + i, this.selectedHint = t.selectedHint || 0;\n for (var n = t.list, h = 0; h < n.length; ++h) {\n var a = l.appendChild(c.createElement(\"li\")),\n u = n[h],\n f = \"CodeMirror-hint\" + (h != this.selectedHint ? \"\" : \" \" + I);\n null != u.className && (f = u.className + \" \" + f), a.className = f, u.render ? u.render(a, t, u) : a.appendChild(c.createTextNode(u.displayText || B(u))), a.hintId = h\n }\n var p, d, m, g = o.options.container || c.body,\n v = s.cursorCoords(o.options.alignWithWord ? t.from : null),\n y = v.left,\n w = v.bottom,\n H = !0,\n C = 0,\n b = 0;\n g !== c.body && (d = (p = -1 !== [\"absolute\", \"relative\", \"fixed\"].indexOf(r.getComputedStyle(g).position) ? g : g.offsetParent).getBoundingClientRect(), m = c.body.getBoundingClientRect(), C = d.left - m.left - p.scrollLeft, b = d.top - m.top - p.scrollTop), l.style.left = y - C + \"px\", l.style.top = w - b + \"px\";\n var k = r.innerWidth || Math.max(c.body.offsetWidth, c.documentElement.offsetWidth),\n A = r.innerHeight || Math.max(c.body.offsetHeight, c.documentElement.offsetHeight);\n g.appendChild(l);\n var x, T, S = l.getBoundingClientRect(),\n M = S.bottom - A,\n N = l.scrollHeight > l.clientHeight + 1,\n F = s.getScrollInfo();\n 0 < M && (x = S.bottom - S.top, 0 < v.top - (v.bottom - S.top) - x ? (l.style.top = (w = v.top - x - b) + \"px\", H = !1) : A < x && (l.style.height = A - 5 + \"px\", l.style.top = (w = v.bottom - S.top - b) + \"px\", T = s.getCursor(), t.from.ch != T.ch && (v = s.cursorCoords(T), l.style.left = (y = v.left - C) + \"px\", S = l.getBoundingClientRect())));\n var E, O = S.right - k;\n if (0 < O && (S.right - S.left > k && (l.style.width = k - 5 + \"px\", O -= S.right - S.left - k), l.style.left = (y = v.left - O - C) + \"px\"), N)\n for (var P = l.firstChild; P; P = P.nextSibling) P.style.paddingRight = s.display.nativeBarWidth + \"px\";\n return s.addKeyMap(this.keyMap = function (t, n) {\n var o = {\n Up: function () {\n n.moveFocus(-1)\n },\n Down: function () {\n n.moveFocus(1)\n },\n PageUp: function () {\n n.moveFocus(1 - n.menuSize(), !0)\n },\n PageDown: function () {\n n.moveFocus(n.menuSize() - 1, !0)\n },\n Home: function () {\n n.setFocus(0)\n },\n End: function () {\n n.setFocus(n.length - 1)\n },\n Enter: n.pick,\n Tab: n.pick,\n Esc: n.close\n };\n /Mac/.test(navigator.platform) && (o[\"Ctrl-P\"] = function () {\n n.moveFocus(-1)\n }, o[\"Ctrl-N\"] = function () {\n n.moveFocus(1)\n });\n var i = t.options.customKeys,\n s = i ? {} : o;\n\n function e(t, i) {\n var e = \"string\" != typeof i ? function (t) {\n return i(t, n)\n } : o.hasOwnProperty(i) ? o[i] : i;\n s[t] = e\n }\n if (i)\n for (var c in i) i.hasOwnProperty(c) && e(c, i[c]);\n var r = t.options.extraKeys;\n if (r)\n for (var c in r) r.hasOwnProperty(c) && e(c, r[c]);\n return s\n }(o, {\n moveFocus: function (t, i) {\n e.changeActive(e.selectedHint + t, i)\n },\n setFocus: function (t) {\n e.changeActive(t)\n },\n menuSize: function () {\n return e.screenAmount()\n },\n length: n.length,\n close: function () {\n o.close()\n },\n pick: function () {\n e.pick()\n },\n data: t\n })), o.options.closeOnUnfocus && (s.on(\"blur\", this.onBlur = function () {\n E = setTimeout(function () {\n o.close()\n }, 100)\n }), s.on(\"focus\", this.onFocus = function () {\n clearTimeout(E)\n })), s.on(\"scroll\", this.onScroll = function () {\n var t = s.getScrollInfo(),\n i = s.getWrapperElement().getBoundingClientRect(),\n e = w + F.top - t.top,\n n = e - (r.pageYOffset || (c.documentElement || c.body).scrollTop);\n if (H || (n += l.offsetHeight), n <= i.top || n >= i.bottom) return o.close();\n l.style.top = e + \"px\", l.style.left = y + F.left - t.left + \"px\"\n }), W.on(l, \"dblclick\", function (t) {\n var i = K(l, t.target || t.srcElement);\n i && null != i.hintId && (e.changeActive(i.hintId), e.pick())\n }), W.on(l, \"click\", function (t) {\n var i = K(l, t.target || t.srcElement);\n i && null != i.hintId && (e.changeActive(i.hintId), o.options.completeOnSingleClick && e.pick())\n }), W.on(l, \"mousedown\", function () {\n setTimeout(function () {\n s.focus()\n }, 20)\n }), this.scrollToActive(), W.signal(t, \"select\", n[this.selectedHint], l.childNodes[this.selectedHint]), !0\n }\n\n function r(t, i, e, n) {\n var o;\n t.async ? t(i, n, e) : (o = t(i, e)) && o.then ? o.then(n) : n(o)\n }\n o.prototype = {\n close: function () {\n this.active() && (this.cm.state.completionActive = null, this.tick = null, this.cm.off(\"cursorActivity\", this.activityFunc), this.widget && this.data && W.signal(this.data, \"close\"), this.widget && this.widget.close(), W.signal(this.cm, \"endCompletion\", this.cm))\n },\n active: function () {\n return this.cm.state.completionActive == this\n },\n pick: function (t, i) {\n var e = t.list[i],\n n = this;\n this.cm.operation(function () {\n e.hint ? e.hint(n.cm, t, e) : n.cm.replaceRange(B(e), e.from || t.from, e.to || t.to, \"complete\"), W.signal(t, \"pick\", e), n.cm.scrollIntoView()\n }), this.close()\n },\n cursorActivity: function () {\n this.debounce && (c(this.debounce), this.debounce = 0);\n var t = this.startPos;\n this.data && (t = this.data.from);\n var i, e = this.cm.getCursor(),\n n = this.cm.getLine(e.line);\n e.line != this.startPos.line || n.length - e.ch != this.startLen - this.startPos.ch || e.ch < t.ch || this.cm.somethingSelected() || !e.ch || this.options.closeCharacters.test(n.charAt(e.ch - 1)) ? this.close() : ((i = this).debounce = s(function () {\n i.update()\n }), this.widget && this.widget.disable())\n },\n update: function (i) {\n var e, n;\n null != this.tick && (n = ++(e = this).tick, r(this.options.hint, this.cm, this.options, function (t) {\n e.tick == n && e.finishUpdate(t, i)\n }))\n },\n finishUpdate: function (t, i) {\n this.data && W.signal(this.data, \"update\");\n var e = this.widget && this.widget.picked || i && this.options.completeSingle;\n this.widget && this.widget.close(), (this.data = t) && t.list.length && (e && 1 == t.list.length ? this.pick(t, 0) : (this.widget = new n(this, t), W.signal(t, \"shown\")))\n }\n }, n.prototype = {\n close: function () {\n var t;\n this.completion.widget == this && (this.completion.widget = null, this.hints.parentNode.removeChild(this.hints), this.completion.cm.removeKeyMap(this.keyMap), t = this.completion.cm, this.completion.options.closeOnUnfocus && (t.off(\"blur\", this.onBlur), t.off(\"focus\", this.onFocus)), t.off(\"scroll\", this.onScroll))\n },\n disable: function () {\n this.completion.cm.removeKeyMap(this.keyMap);\n var t = this;\n this.keyMap = {\n Enter: function () {\n t.picked = !0\n }\n }, this.completion.cm.addKeyMap(this.keyMap)\n },\n pick: function () {\n this.completion.pick(this.data, this.selectedHint)\n },\n changeActive: function (t, i) {\n var e;\n t >= this.data.list.length ? t = i ? this.data.list.length - 1 : 0 : t < 0 && (t = i ? 0 : this.data.list.length - 1), this.selectedHint != t && ((e = this.hints.childNodes[this.selectedHint]) && (e.className = e.className.replace(\" \" + I, \"\")), (e = this.hints.childNodes[this.selectedHint = t]).className += \" \" + I, this.scrollToActive(), W.signal(this.data, \"select\", this.data.list[this.selectedHint], e))\n },\n scrollToActive: function () {\n var t = this.completion.options.scrollMargin || 0,\n i = this.hints.childNodes[Math.max(0, this.selectedHint - t)],\n e = this.hints.childNodes[Math.min(this.data.list.length - 1, this.selectedHint + t)],\n n = this.hints.firstChild;\n i.offsetTop < this.hints.scrollTop ? this.hints.scrollTop = i.offsetTop - n.offsetTop : e.offsetTop + e.offsetHeight > this.hints.scrollTop + this.hints.clientHeight && (this.hints.scrollTop = e.offsetTop + e.offsetHeight - this.hints.clientHeight + n.offsetTop)\n },\n screenAmount: function () {\n return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1\n }\n }, W.registerHelper(\"hint\", \"auto\", {\n resolve: function (t, i) {\n var e, c = t.getHelpers(i, \"hint\");\n if (c.length) {\n var n = function (t, n, o) {\n var s = function (t, i) {\n if (!t.somethingSelected()) return i;\n for (var e = [], n = 0; n < i.length; n++) i[n].supportsSelection && e.push(i[n]);\n return e\n }(t, c);\n ! function i(e) {\n if (e == s.length) return n(null);\n r(s[e], t, o, function (t) {\n t && 0 < t.list.length ? n(t) : i(e + 1)\n })\n }(0)\n };\n return n.async = !0, n.supportsSelection = !0, n\n }\n return (e = t.getHelper(t.getCursor(), \"hintWords\")) ? function (t) {\n return W.hint.fromList(t, {\n words: e\n })\n } : W.hint.anyword ? function (t, i) {\n return W.hint.anyword(t, i)\n } : function () {}\n }\n }), W.registerHelper(\"hint\", \"fromList\", function (t, i) {\n var e, n = t.getCursor(),\n o = t.getTokenAt(n),\n s = W.Pos(n.line, o.start),\n c = n;\n o.start < n.ch && /\\w/.test(o.string.charAt(n.ch - o.start - 1)) ? e = o.string.substr(0, n.ch - o.start) : (e = \"\", s = n);\n for (var r = [], l = 0; l < i.words.length; l++) {\n var h = i.words[l];\n h.slice(0, e.length) == e && r.push(h)\n }\n if (r.length) return {\n list: r,\n from: s,\n to: c\n }\n }), W.commands.autocomplete = W.showHint;\n var l = {\n hint: W.hint.auto,\n completeSingle: !0,\n alignWithWord: !0,\n closeCharacters: /[\\s()\\[\\]{};:>,]/,\n closeOnUnfocus: !0,\n completeOnSingleClick: !0,\n container: null,\n customKeys: null,\n extraKeys: null\n };\n W.defineOption(\"hintOptions\", null)\n});", "created": "20210328012150088", "modified": "20210328012150088", "module-type": "codemirror", "type": "application/javascript" }, "$:/plugins/tiddlywiki/codemirror/mode/tw5/tw5.css": { "title": "$:/plugins/tiddlywiki/codemirror/mode/tw5/tw5.css", "created": "20200815103937889", "modified": "20210328054714579", "module-type": "codemirror-theme", "name": "cmplus", "tags": "$:/tags/Stylesheet", "type": "text/vnd.tiddlywiki", "text": "```\n/*\nTiddlywiki Metadata\n----\nName: $:/plugins/tiddlywiki/codemirror/mode/tw5/tw5.css\n\nAdditional Fields - \nmodule-type: codemirror-theme\nname: cmplus\n*/\n```\n\n.cm-s-cmplus{\n line-height: 1.5em;\n background: <> !important;\n color: <> !important;\n}\n\n.cm-s-cmplus .CodeMirror-lines {\n padding: 8px 0;\n}\n\n.cm-s-cmplus .CodeMirror-linenumber {\n color: <>;\n}\n\n.cm-s-cmplus .CodeMirror-gutters {\n background-color: <>;\n padding-right: 10px;\n z-index: 3;\n border: none;\n}\n\n.cm-s-cmplus div.CodeMirror-cursor {\n border-left: 3px solid <>;\n}\n\n.cm-s-cmplus .CodeMirror-activeline-background {\n background: <>;\n}\n\n.cm-s-cmplus .CodeMirror-selected {\n background: <> !important;\n}\n\n.cm-s-cmplus .cm-comment {\n font-style: italic;\n color: <>;\n}\n\n.cm-s-cmplus .CodeMirror-matchingbracket {\n text-decoration: underline;\n color: <> !important;\n}\n\n.cm-s-cmplus .cm-strikethrough {\n text-decoration-color: <>; \n}\n\n.cm-s-cmplus .cm-underlined {\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-color: <>;\n}\n\n.cm-s-cmplus .cm-superscript {\n vertical-align: super;\n font-size: 0.7em;\n line-height: 0.1em;\n}\n\n.cm-s-cmplus .cm-subscript {\n font-size: 0.7em;\n line-height: 0.5;\n}\n\n.cm-s-cmplus .cm-macro {\n color: <>;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\n.cm-s-cmplus .cm-keyword {\n color: <>;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n font-weight: 600;\n}\n\n.cm-s-cmplus .cm-quote {\n font-style: italic;\n padding-left: 0.6em;\n border-left: <> solid 0.2em;\n}\n\n.cm-s-cmplus .cm-hr {\n color: <>;\n}\n\n.cm-s-cmplus .cm-h1 {\n color: <>;\n font-weight: 700;\n font-size: 1.383em;\n line-height: 1.802em;\n}\n\n.cm-s-cmplus .cm-h2 {\n color: <>;\n font-weight: 600;\n font-size: 1.296em;\n line-height: 1.602em;\n}\n\n.cm-s-cmplus .cm-h3 {\n color: <>;\n font-weight: 500;\n font-size: 1.215em;\n line-height: 1.424em;\n}\n\n.cm-s-cmplus .cm-h4 {\n color: <>;\n font-weight: 400;\n font-size: 1.138em;\n line-height: 1.266em;\n}\n\n.cm-s-cmplus .cm-h5 {\n color: <>;\n font-weight: 400;\n font-size: 1.067em;\n line-height: 1.125em;\n}\n\n.cm-s-cmplus .cm-h6 {\n color: <>;\n font-weight: 400;\n}\n\n.cm-s-cmplus .cm-link {\n color: <>;\n text-decoration: none;\n font-weight: 600;\n}\n\n.cm-s-cmplus .cm-internallink {\n color: <>;\n font-weight:600;\n}\n\n.cm-s-cmplus .cm-externallink {\n color: <>;\n text-decoration: underline;\n}\n\n.cm-s-cmplus .cm-transclude {\n color: <>;\n}\n\n.cm-s-cmplus .cm-pre {\n color: <>;\t\t\n font-family: {{$:/plugins/adithyab/cmplus/settings##monospace-font}};\n}\n\n.cm-s-cmplus .cm-monospace {\n color: <>;\n font-family: {{$:/plugins/adithyab/cmplus/settings##monospace-font}};\n}\n\n.cm-s-cmplus .cm-list1 {\n color: <>;\n padding-left: 1em;\n padding-right: 0.5em;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\n.cm-s-cmplus .cm-list2 {\n color: <>;\n padding-left: 2em;\n padding-right: 0.5em;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\n.cm-s-cmplus .cm-list3 {\n color: <>;\n padding-left: 3em;\n padding-right: 0.5em;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\n.cm-s-cmplus .cm-list4 {\n color: <>;\n padding-left: 4em;\n padding-right: 0.5em;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}\n\n.cm-s-cmplus .cm-list5 {\n color: <>;\n padding-left: 5em;\n padding-right: 0.5em;\n font-family: {{$:/themes/tiddlywiki/vanilla/settings/codefontfamily}};\n}" }, "$:/plugins/tiddlywiki/codemirror/mode/tw5/tw5.js": { "title": "$:/plugins/tiddlywiki/codemirror/mode/tw5/tw5.js", "text": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n/***\n\n|''Name''|tw5.js|\n|''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror|\n|''Original Contributor''|PMario|\n|''Author''|[[adithya-badidey|https://github.com/adithya-badidey]]|\n|''Version''|0.1.8|\n|''Status''|''stable''|\n|''Source''|[[GitHub|https://github.com/adithya-badidey/TW5-codemirror-plus]]|\n|''Documentation''|https://codemirror.tiddlyspace.com/|\n|''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]|\n|''Requires''|codemirror.js|\n|''Keywords''|syntax highlighting color code mirror codemirror|\n\n!! Tiddlywiki Metadata\nName: $:/plugins/tiddlywiki/codemirror/mode/tw5/tw5.js\nType: application/javascript\nAdditional Field:\nmodule-type: codemirror\n \nInfo: CoreVersion parameter is needed for TiddlyWiki only!\n\n***/\n\n(function (mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function (CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineMode(\"tiddlywiki5\", function () {\n // Tokenizer\n var textwords = {};\n\n var keywords = {\n \"changecount\": true, \"colour\": true,\n \"colour-picker\": true, \"contrastcolour\": true,\n \"copy-to-clipboard\": true, \"csvtiddlers\": true,\n \"datauri\": true, \"dumpvariables\": true,\n \"image-picker\": true, \"jsontiddler\": true,\n \"jsontiddlers\": true, \"lingo\": true,\n \"list-links\": true, \"list-links-draggable\": true,\n \"list-tagged-draggable\": true, \"list-thumbnails\": true,\n \"makedatauri\": true, \"now\": true,\n \"qualify\": true, \"resolvepath\": true,\n \"box-shadow\": true, \"filter\": true,\n \"transition\": true, \"background-linear-gradient\": true,\n \"transform-origin\": true, \"toc\": true,\n \"toc-expandable\": true, \"toc-selective-expandable\": true,\n \"toc-tabbed-internal-nav\": true, \"toc-tabbed-external-nav\": true,\n \"tabs\": true, \"tag\": true,\n \"tag-picker\": true, \"tag-pill\": true,\n \"thumbnail\": true, \"timeline\": true,\n \"tree\": true, \"unusedtitle\": true,\n \"version\": true\n };\n\n var isSpaceName = /[\\w_\\-]/i,\n reHR = /^\\-\\-\\-\\-+$/, //
\n reBlockQuote = /^<< Returns true only if the stream is at the start of the line.\n ch = stream.peek(); // Returns the next character in the stream without advancing it. Will return a null at the end of the line.\n\n // check start of blocks\n if (sol && /[<\\/\\*{}\\-`]/.test(ch)) { //is at the start of a line and the next char is not\n if (stream.match(reBlockQuote)) {\n return chain(stream, state, twTokenQuote);\n }\n \n if (stream.match(reHR))\n return 'hr';\n\n if (stream.match(rePreStart))\n return chain(stream, state, twTokenPre);\n }\n\n stream.next();\n if (sol && /[\\/\\*!#;:>|]/.test(ch)) {\n if (ch == \"!\") { // tw header\n var count = 1;\n while (stream.eat('!'))\n count++;\n stream.skipToEnd();\n return \"h\" + count;\n }\n\n if (ch == \"*\" || ch == \"#\") { // tw list\n var count = 1;\n while (stream.eat('*') || stream.eat('#'))\n count++;\n return \"list\" + count;\n }\n if (ch == \";\") { // definition list, term\n stream.eatWhile(';');\n return \"list1\";\n }\n if (ch == \":\") { // definition list, description\n stream.eatWhile(':');\n return \"list2\";\n }\n if (ch == \">\") { // single line quote\n stream.eatWhile(\">\");\n return \"quote\";\n }\n if (ch == '|')\n return 'header';\n }\n\n // rudimentary html:// file:// link matching. TW knows much more ...\n if (/[hf]/i.test(ch) &&\n /[ti]/i.test(stream.peek()) &&\n stream.match(/\\b(ttps?|tp|ile):\\/\\/[\\-A-Z0-9+&@#\\/%?=~_|$!:,.;]*[A-Z0-9+&@#\\/%=~_|$]/i, true))\n return \"externallink\";\n\n if (ch == '`') { //\n return chain(stream, state, twTokenMonospace);\n }\n\n if (ch == \"/\" && stream.eat(\"/\")) { //\n return chain(stream, state, twTokenEm);\n }\n\n if (ch == \"{\" && stream.eat(\"{\")) \n return chain(stream, state, twTranslclude);\n\n if (ch == \"[\" && stream.eat(\"[\")) // tw InternalLink\n return chain(stream, state, twInternalLink);\n\n if (ch == \"_\" && stream.eat(\"_\")) // tw underline\n return chain(stream, state, twTokenUnderline);\n\n if (ch == \"^\" && stream.eat(\"^\"))\n return chain(stream, state, twSuperscript);\n\n if (ch == \",\" && stream.eat(\",\")) // tw underline\n return chain(stream, state, twSubscript);\n\n // tw strikethrough\n if (ch == \"~\" && stream.eat(\"~\")) {\n return chain(stream, state, twTokenStrike);\n }\n\n if (ch == \"'\" && stream.eat(\"'\")) // tw bold\n return chain(stream, state, twTokenStrong);\n\n if (ch == \"<\" && stream.eat(\"<\")) // tw macro\n return chain(stream, state, twTokenMacro);\n\n return null\n }\n\n // // tw invisible comment\n // function twTokenComment(stream, state) {\n // var maybeEnd = false, ch;\n // while (ch = stream.next()) {\n // if (ch == \"/\" && maybeEnd) {\n // state.tokenize = tokenBase;\n // break;\n // }\n // maybeEnd = (ch == \"%\");\n // }\n // return \"comment\";\n // }\n\n // tw strong / bold\n function twTokenStrong(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"'\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"'\");\n }\n return \"strong\";\n }\n\n function twTokenMonospace(stream, state) {\n var ch;\n while (ch = stream.next()) {\n if (ch == \"`\") {\n state.tokenize = tokenBase;\n break;\n }\n }\n return \"monospace\";\n }\n\n // tw em / italic\n function twTokenEm(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"/\");\n }\n return \"em\";\n }\n\n // tw transclusions\n function twTranslclude(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"}\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"}\");\n }\n return \"transclude\";\n }\n\n // tw internal links\n function twInternalLink(stream, state) {\n if (stream.current() == '[[') {\n state.pastDivider = false;\n // console.log(\"Start of link\");\n return 'link';\n }\n if (stream.peek() == ']') {\n stream.next()\n if(stream.next() == ']') {\n state.tokenize = tokenBase;\n // console.log(\"End of link\");\n return 'link';\n }\n }\n var pastDivider = state.pastDivider,\n ch;\n while (ch = stream.peek()) {\n // console.log(\"Peeking :\" + ch);\n if (!pastDivider && ch=='|') {\n stream.next();\n state.pastDivider = true;\n // console.log(\"Past the divider\");\n return 'link';\n }\n if (ch == \"]\" && stream.peek() == \"]\") {\n // console.log(\"Found end of link\");\n return \"internallink\";\n }\n ch = stream.next();\n if (/[hf]/i.test(ch) &&\n /[ti]/i.test(stream.peek()) &&\n stream.match(/\\b(ttps?|tp|ile):\\/\\/[\\-A-Z0-9+&@#\\/%?=~_|$!:,.;]*[A-Z0-9+&@#\\/%=~_|$]/i, true)) {\n // console.log(\"Found external link\");\n return \"externallink\";\n }\n stream.eatWhile(/[^|\\]]/);\n }\n return null;\n }\n\n // tw underlined text\n function twTokenUnderline(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"_\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"_\");\n }\n return \"underlined\";\n }\n\n function twSubscript(stream, state) {\n var maybeEnd = false, ch;\n\n while (ch = stream.next()) {\n if (ch == \",\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \",\");\n }\n return \"subscript\";\n }\n\n function twSuperscript(stream, state) {\n var maybeEnd = false, ch;\n\n while (ch = stream.next()) {\n if (ch == \"^\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"^\");\n }\n return \"superscript\";\n }\n\n function twTokenStrike(stream, state) {\n var maybeEnd = false, ch;\n\n while (ch = stream.next()) {\n if (ch == \"~\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"~\");\n }\n return \"strikethrough\";\n }\n\n function twTokenPre(stream, state) {\n var sol = stream.sol(), maybeEnd = false, surelyend = false, ch;\n while (ch = stream.next()) {\n if (ch == '`' && surelyend && stream.eol()) {\n stream.next();\n state.tokenize = tokenBase;\n return \"pre\";\n }\n surelyend = (maybeEnd && (ch == '`'));\n maybeEnd = (sol && ch == '`');\n sol = stream.sol();\n }\n return \"pre\";\n }\n\n function twTokenQuote(stream, state) {\n var sol = stream.sol(), maybeEnd = false, surelyend = false, ch;\n while (ch = stream.next()) {\n if (ch == '<' && surelyend) {\n stream.skipToEnd();\n state.tokenize = tokenBase;\n return \"quote\";\n }\n surelyend = (maybeEnd && (ch == '<'));\n maybeEnd = (sol && ch == '<');\n sol = stream.sol();\n }\n return \"quote\";\n }\n\n\n function twTokenMacro(stream, state) {\n if (stream.current() == '<<') {\n return 'macro';\n }\n\n var ch = stream.next();\n if (!ch) {\n state.tokenize = tokenBase;\n return null;\n }\n if (ch == \">\") {\n if (stream.peek() == '>') {\n stream.next();\n state.tokenize = tokenBase;\n return \"macro\";\n }\n }\n\n stream.eatWhile(/[\\w\\$_]/);\n return keywords.propertyIsEnumerable(stream.current()) ? \"keyword\" : \"macro\"\n }\n\n // Interface\n return {\n startState: function () {\n return { tokenize: tokenBase };\n },\n\n token: function (stream, state) {\n if (stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n return style;\n }\n };\n });\n\n CodeMirror.defineMIME(\"text/vnd.tiddlywiki\", \"tiddlywiki5\");\n});", "created": "20200818164318584", "modified": "20210327052450347", "module-type": "codemirror", "revision": "1", "type": "application/javascript" }, "$:/plugins/adithyab/cmplus/macros": { "title": "$:/plugins/adithyab/cmplus/macros", "created": "20210328020051916", "modified": "20210328053732117", "tags": "$:/tags/Macro", "type": "text/vnd.tiddlywiki", "text": "\\define cmcolour(name)\n{{$:/plugins/adithyab/cmplus/settings##$name$}}\n\\end" }, "$:/plugins/adithyab/cmplus/readme": { "title": "$:/plugins/adithyab/cmplus/readme", "created": "20210328060842133", "modified": "20210328060929665", "tags": "", "type": "text/vnd.tiddlywiki", "text": "!! TW5 CodeMirrorPlus\nTowards making a better editor for TiddlyWiki5.\n" }, "$:/plugins/adithyab/cmplus/settings": { "title": "$:/plugins/adithyab/cmplus/settings", "text": "monospace-font:monospace,\"Courier New\"\nselected:rgba(100,100,100,0.3)\nlinenumber:<>\nkeyword:<>\nmacro:<>\nquote:<>\npre:<>\nexternallink:<>\ninternallink:<>\nlink:<>\ntransclude:<>\nmonospace:<>\nlist1:<>\nlist2:<>\nlist3:<>\nlist4:<>\nlist5:<>\nlist6:<>\nh1:<>\nh2:<>\nh3:<>\nh4:<>\nh5:<>\nh6:<>\nhr:<>", "type": "application/x-tiddler-dictionary", "created": "20210328015904035", "modified": "20210328054754059", "tags": "" } } }