You've already forked obsidian-visualiser
Update codemirror to v6 and refactor editor to make own HyperMD like rich content editor.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { defineMode, type Mode, getMode, StringStream, startState } from "codemirror";
|
||||
/* import { defineMode, type Mode, getMode, StringStream, startState } from "codemirror";
|
||||
import type { MarkdownState } from "hypermd/mode/hypermd";
|
||||
|
||||
const EN = /^(?:[*\-+]|^[0-9]+([.)]))\s+/, SN = /^(?:(?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i, xN = /^(?:(?:[^<>()[\]\\.,;:\s@\"`]+(?:\.[^<>()[\]\\.,;:\s@\"]+)*)|(?:\".+\"))@(?:(?:\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(?:(?:[a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))\b/, TN = /^(?:[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s])+/;
|
||||
@@ -208,13 +208,6 @@ defineMode('d-any', function(cm, config) {
|
||||
|
||||
type InnerModeOptions = InnerModeOptions1 | InnerModeOptions2
|
||||
|
||||
/**
|
||||
* switch to another mode
|
||||
*
|
||||
* After entering a mode, you can then set `hmdInnerExitStyle` and `hmdInnerState` of `state`
|
||||
*
|
||||
* @returns if `skipFirstToken` not set, returns `innerMode.token(stream, innerState)`, meanwhile, stream advances
|
||||
*/
|
||||
function enterMode(stream: StringStream, state: HyperMDState, mode: string | CodeMirror.Mode<any> | null, opt: InnerModeOptions): string {
|
||||
if (typeof mode === "string") mode = getMode(cm, mode);
|
||||
|
||||
@@ -405,7 +398,7 @@ defineMode('d-any', function(cm, config) {
|
||||
!/[\s<>()[\]\\.,;:\s@\"`]/.test(p!) && stream.match(xN))) && (y += " url",
|
||||
w = stream.pos)),
|
||||
h && state.inFootnote) {
|
||||
let F = stream.match(/^\s*/, !1)[0].replace(/\stream/g, " ").length;
|
||||
let F = stream.match(/^\s*\/, !1)[0].replace(/\stream/g, " ").length;
|
||||
F && F % stream.tabSize == 0 ? y += " line-HyperMD-footnote" : state.inFootnote = !1
|
||||
}
|
||||
let O = h && "[" === stream.peek() && stream.match(/^\[((?:[^\]\\]|\\.)*)\]:/, !1);
|
||||
@@ -667,4 +660,4 @@ defineMode('d-any', function(cm, config) {
|
||||
return y.trim() || null;
|
||||
},
|
||||
}
|
||||
}, 'd-any');
|
||||
}, 'd-any'); */
|
||||
Reference in New Issue
Block a user