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
LoadPlugins = async (settings) => { const isBase = settings.hasOwnProperty("global") const plugins = { enable: {}, disable: {}, stop: {}, error: {}, nosetting: {} } const promises = Object.entries(settings).map(async ([fixedName, setting]) => { if (!setting) { plugins.nosetting[fixedName...
Cleanup, generally used for memory reclamation, used infrequently.
LoadPlugins
javascript
obgnail/typora_plugin
plugin/global/core/plugin.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/plugin.js
MIT
constructor(utils, i18n) { this.utils = utils; this.i18n = i18n; this.diagramModeFlag = "custom_diagram"; // can be any value, just a flag this.panel = `<div class="md-diagram-panel md-fences-adv-panel"><div class="md-diagram-panel-header"></div><div class="md-diagram-panel-preview"></d...
Dynamically register and unregister new code block diagram.
constructor
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
after = mode => { if (!mode) return mode const isObj = typeof mode === "object" const originLang = isObj ? mode.name : mode const mappingLang = this.langMapping.get(originLang) if (!mappingLang) { return mode } if (!isO...
If the fenceEnhance plugin is disabled and EXIT_INTERACTIVE_MODE === click_exit_button, then force all charts to disable interactive mode.
after
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
after = mode => { if (!mode) return mode const isObj = typeof mode === "object" const originLang = isObj ? mode.name : mode const mappingLang = this.langMapping.get(originLang) if (!mappingLang) { return mode } if (!isO...
If the fenceEnhance plugin is disabled and EXIT_INTERACTIVE_MODE === click_exit_button, then force all charts to disable interactive mode.
after
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
afterExport = () => { setTimeout(() => { for (const lang of this.parsers.keys()) { this.refreshAllLangFence(lang) } }, 300) }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
afterExport
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
afterExport = () => { setTimeout(() => { for (const lang of this.parsers.keys()) { this.refreshAllLangFence(lang) } }, 300) }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
afterExport
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
callback = () => { const beforeToHTML = () => { const extraCssList = [] this.parsers.forEach((parser, lang) => { this.renderAllLangFence(lang) const getter = parser.extraStyleGetter const exist = this.utils.entities....
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
callback
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
callback = () => { const beforeToHTML = () => { const extraCssList = [] this.parsers.forEach((parser, lang) => { this.renderAllLangFence(lang) const getter = parser.extraStyleGetter const exist = this.utils.entities....
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
callback
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
beforeToHTML = () => { const extraCssList = [] this.parsers.forEach((parser, lang) => { this.renderAllLangFence(lang) const getter = parser.extraStyleGetter const exist = this.utils.entities.querySelectorInWrite(`.md-fences[lang...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
beforeToHTML
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
beforeToHTML = () => { const extraCssList = [] this.parsers.forEach((parser, lang) => { this.renderAllLangFence(lang) const getter = parser.extraStyleGetter const exist = this.utils.entities.querySelectorInWrite(`.md-fences[lang...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
beforeToHTML
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
beforeToNative = () => { this.parsers.forEach((parser, lang) => { this.renderAllLangFence(lang) const previews = this.utils.entities.querySelectorAllInWrite(`.md-fences[lang="${lang}"] .md-diagram-panel-preview`) previews.forEach(preview => { ...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
beforeToNative
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
beforeToNative = () => { this.parsers.forEach((parser, lang) => { this.renderAllLangFence(lang) const previews = this.utils.entities.querySelectorAllInWrite(`.md-fences[lang="${lang}"] .md-diagram-panel-preview`) previews.forEach(preview => { ...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
beforeToNative
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
enableFocus = () => { dontFocus = false; setTimeout(() => dontFocus = true, 200); }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
enableFocus
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
enableFocus = () => { dontFocus = false; setTimeout(() => dontFocus = true, 200); }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
enableFocus
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
stopCall = (...args) => { if (!dontFocus || !args || !args[0]) return; const cid = ("string" == typeof args[0]) ? args[0] : args[0]["id"]; if (cid) { const lang = (File.editor.findElemById(cid).attr("lang") || "").trim().toLowerCase(); if (!cid || !la...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
stopCall
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
stopCall = (...args) => { if (!dontFocus || !args || !args[0]) return; const cid = ("string" == typeof args[0]) ? args[0] : args[0]["id"]; if (cid) { const lang = (File.editor.findElemById(cid).attr("lang") || "").trim().toLowerCase(); if (!cid || !la...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
stopCall
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
showAllTButton = fence => { const enhance = fence.querySelector(".fence-enhance"); if (!enhance) return; enhance.querySelectorAll(".enhance-btn").forEach(ele => ele.style.display = ""); return enhance }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
showAllTButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
showAllTButton = fence => { const enhance = fence.querySelector(".fence-enhance"); if (!enhance) return; enhance.querySelectorAll(".enhance-btn").forEach(ele => ele.style.display = ""); return enhance }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
showAllTButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
showEditButtonOnly = fence => { const enhance = fence.querySelector(".fence-enhance"); if (!enhance) return; enhance.style.display = ""; enhance.querySelectorAll(".enhance-btn").forEach(ele => ele.style.display = "none"); enhance.querySelector(".edit-diagram")...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
showEditButtonOnly
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
showEditButtonOnly = fence => { const enhance = fence.querySelector(".fence-enhance"); if (!enhance) return; enhance.style.display = ""; enhance.querySelectorAll(".enhance-btn").forEach(ele => ele.style.display = "none"); enhance.querySelector(".edit-diagram")...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
showEditButtonOnly
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
hideAllButton = fence => { const enhance = showAllTButton(fence); if (!enhance) return; const editButton = enhance.querySelector(".edit-diagram"); if (editButton) { editButton.style.display = "none"; } enhance.style.display = "none"...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
hideAllButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
hideAllButton = fence => { const enhance = showAllTButton(fence); if (!enhance) return; const editButton = enhance.querySelector(".edit-diagram"); if (editButton) { editButton.style.display = "none"; } enhance.style.display = "none"...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
hideAllButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
registerFenceEnhanceButton = (className, action, hint, iconClassName, enable, listener, extraFunc) => { const btn = { className, action, hint, iconClassName, enable, listener, extraFunc } return this.utils.callPluginFunction("fence_enhance", "registerButton", btn) }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
registerFenceEnhanceButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
registerFenceEnhanceButton = (className, action, hint, iconClassName, enable, listener, extraFunc) => { const btn = { className, action, hint, iconClassName, enable, listener, extraFunc } return this.utils.callPluginFunction("fence_enhance", "registerButton", btn) }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
registerFenceEnhanceButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
handleCtrlClick = () => { const ctrlClick = this.exitInteractiveStrategies.includes("ctrl_click_fence"); if (!ctrlClick) return; this.utils.entities.eWrite.addEventListener("mouseup", ev => { if (this.utils.metaKeyPressed(ev) && ev.target.closest(".md-fences-interacti...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
handleCtrlClick
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
handleCtrlClick = () => { const ctrlClick = this.exitInteractiveStrategies.includes("ctrl_click_fence"); if (!ctrlClick) return; this.utils.entities.eWrite.addEventListener("mouseup", ev => { if (this.utils.metaKeyPressed(ev) && ev.target.closest(".md-fences-interacti...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
handleCtrlClick
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
handleEditButton = () => { const editBtn = this.exitInteractiveStrategies.includes("click_exit_button"); const hasInteractive = Array.from(this.parsers.values()).some(parser => parser.interactiveMode); if (!editBtn || !hasInteractive) return; const editText = this.i18n.t...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
handleEditButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
handleEditButton = () => { const editBtn = this.exitInteractiveStrategies.includes("click_exit_button"); const hasInteractive = Array.from(this.parsers.values()).some(parser => parser.interactiveMode); if (!editBtn || !hasInteractive) return; const editText = this.i18n.t...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
handleEditButton
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
listener = (ev, button) => { button.closest(".fence-enhance").querySelectorAll(".enhance-btn").forEach(ele => ele.style.display = ""); enableFocus(); }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
listener
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
listener = (ev, button) => { button.closest(".fence-enhance").querySelectorAll(".enhance-btn").forEach(ele => ele.style.display = ""); enableFocus(); }
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
listener
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
after = (result, ...args) => { if (result === true) return true; let lang = args[0]; if (!lang) return false; const type = typeof lang; if (type === "object" && lang.mappingType === this.diagramModeFlag) return true; if (type === "object" && lang...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
after
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
after = (result, ...args) => { if (result === true) return true; let lang = args[0]; if (!lang) return false; const type = typeof lang; if (type === "object" && lang.mappingType === this.diagramModeFlag) return true; if (type === "object" && lang...
Called when a syntax error occurs in the code block content, at which point the page will display an error message.
after
javascript
obgnail/typora_plugin
plugin/global/core/utils/diagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/diagramParser.js
MIT
constructor(utils) { this.utils = utils this.htmlHelpers = new Map() this.nativeHelpers = new Map() this.isAsync = undefined }
Dynamically register additional actions on export.
constructor
javascript
obgnail/typora_plugin
plugin/global/core/utils/exportHelper.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/exportHelper.js
MIT
async function walk(dir) { const files = await readdir(dir) const promises = files.map(async file => { const path = Path.join(dir, file) const stats = await stat(path) if (stats.isFile()) { if (fileFilter(path, stats)) { ...
@param {boolean} shouldSave - Whether to save the content. @param {string} contentType - The content type (e.g., 'markdown', 'html'). @param {boolean} skipSetContent - Whether to skip setting the content. @param {any} saveContext - Contextual information for saving (optional). @returns {string} - The content of the edi...
walk
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
imageReplacement = (_, alt, src) => { if (!this.isNetworkImage(src) && !this.isSpecialImage(src)) { src = PATH.resolve(dir || this.getCurrentDirPath(), src); } return `<img alt="${alt}" src="${src}">` }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
imageReplacement
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
imageReplacement = (_, alt, src) => { if (!this.isNetworkImage(src) && !this.isSpecialImage(src)) { src = PATH.resolve(dir || this.getCurrentDirPath(), src); } return `<img alt="${alt}" src="${src}">` }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
imageReplacement
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
function mousemove(e) { requestAnimationFrame(() => { let deltaX = e.clientX - startX; let deltaY = e.clientY - startY; if (onMouseMove) { const { deltaX: newDeltaX, deltaY: newDeltaY } = onMouseMove(deltaX, deltaY) || {}; ...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
mousemove
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
function mouseup() { document.removeEventListener("mousemove", mousemove); document.removeEventListener("mouseup", mouseup); if (onMouseUp) { onMouseUp() } }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
mouseup
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
onMouseMove = ev => { if (withMetaKey && !this.metaKeyPressed(ev) || ev.button !== 0) return; ev.stopPropagation(); ev.preventDefault(); requestAnimationFrame(() => { if (_onMouseMove) { _onMouseMove() ...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
onMouseMove
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
onMouseMove = ev => { if (withMetaKey && !this.metaKeyPressed(ev) || ev.button !== 0) return; ev.stopPropagation(); ev.preventDefault(); requestAnimationFrame(() => { if (_onMouseMove) { _onMouseMove() ...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
onMouseMove
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
onMouseUp = ev => { if (withMetaKey && !this.metaKeyPressed(ev) || ev.button !== 0) return; if (_onMouseUp) { _onMouseUp() } ev.stopPropagation(); ev.preventDefault(); document.removeEventListener("mousem...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
onMouseUp
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
onMouseUp = ev => { if (withMetaKey && !this.metaKeyPressed(ev) || ev.button !== 0) return; if (_onMouseUp) { _onMouseUp() } ev.stopPropagation(); ev.preventDefault(); document.removeEventListener("mousem...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
onMouseUp
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
function decorator(original, before, after) { const fn = function () { if (before) { const error = before.call(this, ...arguments) if (error === utils.stopCallError) return } let result = original.apply(this, arguments) ...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
decorator
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
fn = function () { if (before) { const error = before.call(this, ...arguments) if (error === utils.stopCallError) return } let result = original.apply(this, arguments) if (after) { const afterResu...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
fn
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
fn = function () { if (before) { const error = before.call(this, ...arguments) if (error === utils.stopCallError) return } let result = original.apply(this, arguments) if (after) { const afterResu...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
fn
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
newMixin = (utils) => { const MIXIN = { ...require("./settings"), ...require("./migrate"), ...require("./hotkeyHub"), ...require("./eventHub"), ...require("./stateRecorder"), ...require("./exportHelper"), ...require("./styleTemplater"), ...require("./c...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
newMixin
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
newMixin = (utils) => { const MIXIN = { ...require("./settings"), ...require("./migrate"), ...require("./hotkeyHub"), ...require("./eventHub"), ...require("./stateRecorder"), ...require("./exportHelper"), ...require("./styleTemplater"), ...require("./c...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
newMixin
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
getHook = utils => { const mixin = newMixin(utils) Object.assign(utils, mixin) const { styleTemplater, hotkeyHub, eventHub, stateRecorder, exportHelper, contextMenu, notification, progressBar, formDialog, diagramParser, thirdPartyDiagramParser, } = mixin const registerMixin = (...e...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
getHook
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
getHook = utils => { const mixin = newMixin(utils) Object.assign(utils, mixin) const { styleTemplater, hotkeyHub, eventHub, stateRecorder, exportHelper, contextMenu, notification, progressBar, formDialog, diagramParser, thirdPartyDiagramParser, } = mixin const registerMixin = (...e...
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
getHook
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
registerPreMixin = async () => { await registerMixin(styleTemplater) await registerMixin(contextMenu, notification, progressBar, formDialog, stateRecorder, hotkeyHub, exportHelper) }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
registerPreMixin
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
registerPreMixin = async () => { await registerMixin(styleTemplater) await registerMixin(contextMenu, notification, progressBar, formDialog, stateRecorder, hotkeyHub, exportHelper) }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
registerPreMixin
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
registerPostMixin = async () => { await registerMixin(eventHub) await registerMixin(diagramParser, thirdPartyDiagramParser) eventHub.publishEvent(eventHub.eventType.allPluginsHadInjected) }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
registerPostMixin
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
registerPostMixin = async () => { await registerMixin(eventHub) await registerMixin(diagramParser, thirdPartyDiagramParser) eventHub.publishEvent(eventHub.eventType.allPluginsHadInjected) }
Backup before `File.editor.stylize.toggleFences()` as it uses `File.option` to set block code language. Restore after.
registerPostMixin
javascript
obgnail/typora_plugin
plugin/global/core/utils/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/index.js
MIT
constructor(utils) { this.utils = utils }
Handles migration operations during the upgrade process.
constructor
javascript
obgnail/typora_plugin
plugin/global/core/utils/migrate.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/migrate.js
MIT
constructor(utils) { this.utils = utils; this.recorders = new Map(); // map[name]recorder }
Dynamically register and unregister element state recorders (only effective when the window_tab plugin is enabled). Functionality: Record the state of elements before the user switches tabs, and restore the state of the elements when the user switches back. For example: plugin `collapse_paragraph`: It is necessary to r...
constructor
javascript
obgnail/typora_plugin
plugin/global/core/utils/stateRecorder.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/stateRecorder.js
MIT
constructor(utils) { this.utils = utils; this.parsers = new Map(); this.defaultHeight = "230px"; this.defaultBackgroundColor = "#F8F8F8"; this.regexp = /^\/\/{height:"(?<height>.*?)",width:"(?<width>.*?)"}/; }
Dynamically register and unregister third-party code block diagram (derived from DiagramParser).
constructor
javascript
obgnail/typora_plugin
plugin/global/core/utils/thirdPartyDiagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/thirdPartyDiagramParser.js
MIT
getLifeCycleFn = (fnName) => () => { for (const parser of this.parsers.values()) { if (!parser[fnName]) continue parser.instanceMap.forEach((instance, cid) => { const preview = this.utils.entities.querySelectorInWrite(`.md-fences[cid=${cid}] .md-diagram-pa...
Since JS doesn't support interfaces, interface functions are passed as parameters. @param {string} lang: Language. @param {string} mappingLang: Language to map to. @param {boolean} destroyWhenUpdate: Whether to clear the HTML in the preview before updating. @param {boolean} interactiveMode: When in interactive mode, co...
getLifeCycleFn
javascript
obgnail/typora_plugin
plugin/global/core/utils/thirdPartyDiagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/thirdPartyDiagramParser.js
MIT
getLifeCycleFn = (fnName) => () => { for (const parser of this.parsers.values()) { if (!parser[fnName]) continue parser.instanceMap.forEach((instance, cid) => { const preview = this.utils.entities.querySelectorInWrite(`.md-fences[cid=${cid}] .md-diagram-pa...
Since JS doesn't support interfaces, interface functions are passed as parameters. @param {string} lang: Language. @param {string} mappingLang: Language to map to. @param {boolean} destroyWhenUpdate: Whether to clear the HTML in the preview before updating. @param {boolean} interactiveMode: When in interactive mode, co...
getLifeCycleFn
javascript
obgnail/typora_plugin
plugin/global/core/utils/thirdPartyDiagramParser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/global/core/utils/thirdPartyDiagramParser.js
MIT
translateFieldBaseProps = (field, pluginI18N) => { baseProps.forEach(prop => { const propVal = field[prop] if (propVal != null) { const commonVal = commonI18N[prop][propVal] const pluginVal = pluginI18N[propVal] fiel...
Will NOT modify the schemas structure, just i18n
translateFieldBaseProps
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldBaseProps = (field, pluginI18N) => { baseProps.forEach(prop => { const propVal = field[prop] if (propVal != null) { const commonVal = commonI18N[prop][propVal] const pluginVal = pluginI18N[propVal] fiel...
Will NOT modify the schemas structure, just i18n
translateFieldBaseProps
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldSpecialProps = (field, pluginI18N) => { specialProps.forEach(prop => { const propVal = field[prop] if (propVal != null) { Object.keys(propVal).forEach(k => { const i18nKey = propVal[k] propVal[k...
Will NOT modify the schemas structure, just i18n
translateFieldSpecialProps
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldSpecialProps = (field, pluginI18N) => { specialProps.forEach(prop => { const propVal = field[prop] if (propVal != null) { Object.keys(propVal).forEach(k => { const i18nKey = propVal[k] propVal[k...
Will NOT modify the schemas structure, just i18n
translateFieldSpecialProps
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldNestedBoxesProp = (field, pluginI18N) => { if (field.nestedBoxes != null) { field.nestedBoxes.forEach(box => translateBox(box, pluginI18N)) } }
Will NOT modify the schemas structure, just i18n
translateFieldNestedBoxesProp
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldNestedBoxesProp = (field, pluginI18N) => { if (field.nestedBoxes != null) { field.nestedBoxes.forEach(box => translateBox(box, pluginI18N)) } }
Will NOT modify the schemas structure, just i18n
translateFieldNestedBoxesProp
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldUnitProp = (field) => { if (field.unit != null) { field.unit = commonI18N.unit[field.unit] } }
Will NOT modify the schemas structure, just i18n
translateFieldUnitProp
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateFieldUnitProp = (field) => { if (field.unit != null) { field.unit = commonI18N.unit[field.unit] } }
Will NOT modify the schemas structure, just i18n
translateFieldUnitProp
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateBox = (box, pluginI18N) => { const t = box.title if (t) { const commonVal = commonI18N.title[t] const pluginVal = pluginI18N[t] box.title = commonVal || pluginVal } box.fields.forEach(field => { tran...
Will NOT modify the schemas structure, just i18n
translateBox
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
translateBox = (box, pluginI18N) => { const t = box.title if (t) { const commonVal = commonI18N.title[t] const pluginVal = pluginI18N[t] box.title = commonVal || pluginVal } box.fields.forEach(field => { tran...
Will NOT modify the schemas structure, just i18n
translateBox
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
uninstall = async () => { const { FsExtra } = this.utils.Package const remove = '<script src="./plugin/index.js" defer="defer"></script>' const windowHTML = this.utils.joinPath("./window.html") const pluginFolder = this.utils.joinPath("./pl...
Callback functions for type="action" settings in schema
uninstall
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
uninstall = async () => { const { FsExtra } = this.utils.Package const remove = '<script src="./plugin/index.js" defer="defer"></script>' const windowHTML = this.utils.joinPath("./window.html") const pluginFolder = this.utils.joinPath("./pl...
Callback functions for type="action" settings in schema
uninstall
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
_decompress = (compressed) => { const [chunk, raw] = compressed.split("-", 2) const rows = raw.match(new RegExp(`\\w{${chunk}}`, "g")) return rows.map(r => parseInt(r, 36).toString(2).padStart(rows.length, "0")) }
Callback functions for type="action" settings in schema
_decompress
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
_decompress = (compressed) => { const [chunk, raw] = compressed.split("-", 2) const rows = raw.match(new RegExp(`\\w{${chunk}}`, "g")) return rows.map(r => parseInt(r, 36).toString(2).padStart(rows.length, "0")) }
Callback functions for type="action" settings in schema
_decompress
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
_toSVG = (compressed, fillColor, size) => { const table = _decompress(compressed) const numModules = table.length const moduleSize = (size / numModules).toFixed(2) const paths = [] for (let rIdx = 0; rIdx < numModules; r...
Callback functions for type="action" settings in schema
_toSVG
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
_toSVG = (compressed, fillColor, size) => { const table = _decompress(compressed) const numModules = table.length const moduleSize = (size / numModules).toFixed(2) const paths = [] for (let rIdx = 0; rIdx < numModules; r...
Callback functions for type="action" settings in schema
_toSVG
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
_incompatibleSwitch = (field, settings, tooltip = this.i18n._t("settings", "$tooltip.lowVersion")) => { field.disabled = true field.tooltip = tooltip settings[field.key] = false }
PreProcessors for specific settings in schema
_incompatibleSwitch
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
_incompatibleSwitch = (field, settings, tooltip = this.i18n._t("settings", "$tooltip.lowVersion")) => { field.disabled = true field.tooltip = tooltip settings[field.key] = false }
PreProcessors for specific settings in schema
_incompatibleSwitch
javascript
obgnail/typora_plugin
plugin/preferences/index.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/preferences/index.js
MIT
constructor() { const TYPE = { OR: "OR", AND: "AND", NOT: "NOT", PAREN_OPEN: "PAREN_OPEN", PAREN_CLOSE: "PAREN_CLOSE", KEYWORD: "KEYWORD", PHRASE: "PHRASE", REGEXP: "REGEXP", QUALIFIER: "QUALIFIER", ...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
constructor
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
setQualifier(scope = ["default", "file", "path", "ext", "content", "time", "size"], operator = [">=", "<=", ":", "=", ">", "<"]) { const byLength = (a, b) => b.length - a.length const _scope = [...scope].sort(byLength).join("|") const _operator = [...operator].sort(byLength).join("|") th...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
setQualifier
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
tokenize(query) { return [...query.trim().matchAll(this.regex)] .map(_tokens => { const [qualifier, operand = ""] = Object.entries(_tokens.groups).find(([_, v]) => v != null) const type = this.TYPE[qualifier] || this.TYPE.KEYWORD return qualifier === t...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
tokenize
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
_parseExpression(tokens) { let node = this._parseTerm(tokens) while (tokens.length > 0) { const type = tokens[0].type if (type === this.TYPE.OR) { tokens.shift() const right = this._parseTerm(tokens) node = { type, left: node, right...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
_parseExpression
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
_parseTerm(tokens) { let node = this._parseFactor(tokens) while (tokens.length > 0) { const type = tokens[0].type if (type === this.TYPE.NOT || type === this.TYPE.AND) { tokens.shift() const right = this._parseFactor(tokens) node = ...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
_parseTerm
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
_parseFactor(tokens) { const qualifier = (tokens[0].type === this.TYPE.QUALIFIER) ? tokens.shift() : { type: this.TYPE.QUALIFIER, scope: "default", operator: ":" } const node = this._parseMatch(tokens) return this._setQualifier(node, qualifier) }
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
_parseFactor
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
_setQualifier(node, qualifier) { if (!node) return const type = node.type const isLeaf = type === this.TYPE.PHRASE || type === this.TYPE.KEYWORD || type === this.TYPE.REGEXP const isDefault = !node.scope || node.scope === "default" if (isLeaf && isDefault) { node.scop...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
_setQualifier
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
parse(query) { query = query.trim() const tokens = this.tokenize(query) if (tokens.length === 0) { // return { type: this.TYPE.KEYWORD, scope: "default", operator: ":", operand: "" } throw new Error(`Empty Tokens`) } this.check(tokens) const ast = ...
grammar: <query> ::= <expression> <expression> ::= <term> ( <or> <term> )* <term> ::= <factor> ( <conjunction> <factor> )* <factor> ::= <qualifier>? <match> <qualifier> ::= <scope> <operator> <match> ::= <keyword> | '"'<keyword>'"' | '/'<regexp>'/' | '('<expression>')' <conjunction> ::= <and> | <not> <a...
parse
javascript
obgnail/typora_plugin
plugin/search_multi/parser.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/parser.js
MIT
constructor(plugin) { this.MIXIN = QualifierMixin this.config = plugin.config this.utils = plugin.utils this.i18n = plugin.i18n this.parser = new Parser() this.qualifiers = new Map() }
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
constructor
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
process() { const qualifiers = this.buildQualifiers() qualifiers.forEach(q => this.qualifiers.set(q.scope, q)) this.parser.setQualifier(qualifiers.map(q => q.scope), Object.keys(this.MIXIN.OPERATOR)) }
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
process
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildQualifiers() { const qualifiers = [...this.buildBaseQualifiers(), ...this.buildMarkdownQualifiers()] qualifiers.forEach(q => { q.preprocess = q.preprocess || this.MIXIN.PREPROCESS.noop q.validate = q.validate || this.MIXIN.VALIDATE.isStringOrRegexp q.anchor = q.a...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildQualifiers
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildBaseQualifiers() { const { PREPROCESS: { resolveDate, resolveNumber, resolveBoolean }, VALIDATE: { isSize, isDate, isNumber, isBoolean }, CAST: { toBytes, toDate, toNumber, toBoolean }, MATCH: { arrayCompare, arrayRegexp }, QUERY: { normalizeDate ...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildBaseQualifiers
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildQualifier = (scope, is_meta, need_read_file, cost, anchor, process) => ({ scope, name: this.i18n.t(`scope.${scope}`), is_meta, need_read_file, cost, anchor, query: QUERY[scope], ...process, })
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildQualifier
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildQualifier = (scope, is_meta, need_read_file, cost, anchor, process) => ({ scope, name: this.i18n.t(`scope.${scope}`), is_meta, need_read_file, cost, anchor, query: QUERY[scope], ...process, })
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildQualifier
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildMarkdownQualifiers() { // Prevent re-parsing of the same file in a SINGLE query const cache = fn => { let cached, result return arg => { if (arg !== cached) { result = fn(arg) cached = arg } ...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildMarkdownQualifiers
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
cache = fn => { let cached, result return arg => { if (arg !== cached) { result = fn(arg) cached = arg } return result } }
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
cache
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
cache = fn => { let cached, result return arg => { if (arg !== cached) { result = fn(arg) cached = arg } return result } }
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
cache
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
preorder = (ast = [], filter) => { const output = [] const recurse = ast => { for (const node of ast) { if (filter(node)) { output.push(node) } const c = node.children if (c &&...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
preorder
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
preorder = (ast = [], filter) => { const output = [] const recurse = ast => { for (const node of ast) { if (filter(node)) { output.push(node) } const c = node.children if (c &&...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
preorder
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
recurse = ast => { for (const node of ast) { if (filter(node)) { output.push(node) } const c = node.children if (c && c.length) { recurse(c) } ...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
recurse
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
recurse = ast => { for (const node of ast) { if (filter(node)) { output.push(node) } const c = node.children if (c && c.length) { recurse(c) } ...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
recurse
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildQuery = (parser, filter, transformer) => { return source => { const ast = parser(source.content) const nodes = preorder(ast, filter) return nodes.flatMap(transformer).filter(Boolean) } }
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildQuery
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildQuery = (parser, filter, transformer) => { return source => { const ast = parser(source.content) const nodes = preorder(ast, filter) return nodes.flatMap(transformer).filter(Boolean) } }
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildQuery
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT
buildQualifier = (scope, anchor, parser, filter, transformer) => ({ scope, name: this.i18n.t(`scope.${scope}`), anchor, is_meta: false, need_read_file: true, cost: 3, preprocess: this.MIXIN.PREPROCESS.noop, validate: this.MI...
The matching process consists of the following steps: (Steps 1-4 are executed once; steps 5-6 are executed repeatedly) 1. Parse: Parses the input to generate an Abstract Syntax Tree (AST) 2. Preprocess: Convert certain specific, predefined, and special meaning vocabulary (e.g. converting 'today' in 'mtime=toda...
buildQualifier
javascript
obgnail/typora_plugin
plugin/search_multi/searcher.js
https://github.com/obgnail/typora_plugin/blob/master/plugin/search_multi/searcher.js
MIT