repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/ui/imagePicker/index.js | src/muya/lib/ui/imagePicker/index.js | import BaseScrollFloat from '../baseScrollFloat'
import { patch, h } from '../../parser/render/snabbdom'
import FolderIcon from '../../assets/icons/folder.svg'
import ImageIcon from '../../assets/icons/image.svg'
import UploadIcon from '../../assets/icons/upload.svg'
import './index.css'
const iconhash = {
'icon-im... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/ui/baseScrollFloat/index.js | src/muya/lib/ui/baseScrollFloat/index.js | import BaseFloat from '../baseFloat'
import { EVENT_KEYS } from '../../config'
class BaseScrollFloat extends BaseFloat {
constructor (muya, name, options = {}) {
super(muya, name, options)
this.scrollElement = null
this.reference = null
this.activeItem = null
this.createScrollElement()
}
cre... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/ui/imageToolbar/index.js | src/muya/lib/ui/imageToolbar/index.js | import BaseFloat from '../baseFloat'
import { patch, h } from '../../parser/render/snabbdom'
import icons from './config'
import './index.css'
const defaultOptions = {
placement: 'top',
modifiers: {
offset: {
offset: '0, 10'
}
},
showArrow: false
}
class ImageToolbar extends BaseFloat {
stati... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/ui/imageToolbar/config.js | src/muya/lib/ui/imageToolbar/config.js | import editIcon from '../../assets/pngicon/imageEdit/2.png'
import inlineIcon from '../../assets/pngicon/inline_image/2.png'
import leftIcon from '../../assets/pngicon/algin_left/2.png'
import middleIcon from '../../assets/pngicon/algin_center/2.png'
import rightIcon from '../../assets/pngicon/algin_right/2.png'
import... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/ui/baseFloat/index.js | src/muya/lib/ui/baseFloat/index.js | import Popper from 'popper.js/dist/esm/popper'
import resizeDetector from 'element-resize-detector'
import { noop } from '../../utils'
import { EVENT_KEYS } from '../../config'
import './index.css'
const defaultOptions = () => ({
placement: 'bottom-start',
modifiers: {
offset: {
offset: '0, 12'
}
}... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/ui/footnoteTool/index.js | src/muya/lib/ui/footnoteTool/index.js | import BaseFloat from '../baseFloat'
import { patch, h } from '../../parser/render/snabbdom'
import WarningIcon from '../../assets/pngicon/warning/2.png'
import './index.css'
const getFootnoteText = block => {
let text = ''
const travel = block => {
if (block.children.length === 0 && block.text) {
text ... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/index.js | src/muya/lib/parser/index.js | import { beginRules, inlineRules, inlineExtensionRules } from './rules'
import { isLengthEven, union } from '../utils'
import { findClosingBracket } from './marked/utils'
import { getAttributes, parseSrcAndTitle, validateEmphasize, lowerPriority } from './utils'
// const CAN_NEST_RULES = ['strong', 'em', 'link', 'del'... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/rules.js | src/muya/lib/parser/rules.js | import { escapeCharacters } from './escapeCharacter'
/* eslint-disable no-useless-escape */
export const beginRules = {
hr: /^(\*{3,}$|^\-{3,}$|^\_{3,}$)/,
code_fense: /^(`{3,})([^`]*)$/,
header: /(^ {0,3}#{1,6}(\s{1,}|$))/,
reference_definition: /^( {0,3}\[)([^\]]+?)(\\*)(\]: *)(<?)([^\s>]+)(>?)(?:( +)(["'(]?... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/escapeCharacter.js | src/muya/lib/parser/escapeCharacter.js | // special character
const charachers = [
'"', '&', '<', '>',
' ', ' ', ' ', ' ',
'<', '>', '&', '"',
'©', '®', '™', '×', '÷',
' ', '¡', '¢', '£', '¤',
'¥', '¦', '§', '¨', '©',
'ª', '«', '¬', '', '®',
'¯', '°', '±', '²', '³',
'´', 'µ', '¶', '·', '¸',
'¹', 'º', '»', '¼', '½',
'¾', '¿', 'À', 'Á', '... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/utils.js | src/muya/lib/parser/utils.js | // ASCII PUNCTUATION character
// export const punctuation = ['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~']
/* eslint-disable no-useless-escape, prefer-regex-literals */
export const PUNCTUATION_REG = new ... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/textRenderer.js | src/muya/lib/parser/marked/textRenderer.js | /**
* TextRenderer
* returns only the textual part of the token
*/
function TextRenderer () {}
// no need for block level renderers
TextRenderer.prototype.strong =
TextRenderer.prototype.em =
TextRenderer.prototype.codespan =
TextRenderer.prototype.del =
TextRenderer.prototype.text = function (text) {
return te... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/blockRules.js | src/muya/lib/parser/marked/blockRules.js | import { edit, noop } from './utils'
/* eslint-disable no-useless-escape */
/**
* Block-Level Rules
*/
export const block = {
newline: /^\n+/,
code: /^( {4}[^\n]+\n*)+/,
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/urlify.js | src/muya/lib/parser/marked/urlify.js | // License: BSD
// Source: https://github.com/django/django/blob/master/django/contrib/admin/static/admin/js/urlify.js
//
// Copyright (c) Django Software Foundation and individual contributors.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitt... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/index.js | src/muya/lib/parser/marked/index.js | import Renderer from './renderer'
import Lexer from './lexer'
import Parser from './parser'
import options from './options'
/**
* Marked
*/
function marked (src, opt = {}) {
// throw error in case of non string input
if (typeof src === 'undefined' || src === null) {
throw new Error('marked(): input paramete... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/lexer.js | src/muya/lib/parser/marked/lexer.js | import { normal, gfm, pedantic } from './blockRules'
import options from './options'
import { splitCells, rtrim, getUniqueId } from './utils'
/**
* Block Lexer
*/
function Lexer (opts) {
this.tokens = []
this.tokens.links = Object.create(null)
this.tokens.footnotes = Object.create(null)
this.footnoteOrder =... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/inlineRules.js | src/muya/lib/parser/marked/inlineRules.js | import { block } from './blockRules'
import { edit, noop } from './utils'
/* eslint-disable no-useless-escape */
/**
* Inline-Level Grammar
*/
const inline = {
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, // eslint-disable-line no-control-regex
url: ... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/slugger.js | src/muya/lib/parser/marked/slugger.js | import { downcode } from './urlify'
/**
* Slugger generates header id
*/
function Slugger () {
this.seen = {}
this.downcodeUnicode = true
}
/**
* Convert string to unique id
*/
Slugger.prototype.slug = function (value) {
let slug = this.downcodeUnicode ? downcode(value) : value
slug = slug
.toLowerC... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/inlineLexer.js | src/muya/lib/parser/marked/inlineLexer.js | import Renderer from './renderer'
import { normal, breaks, gfm, pedantic } from './inlineRules'
import defaultOptions from './options'
import { escape, findClosingBracket, getUniqueId, rtrim } from './utils'
import { validateEmphasize, lowerPriority } from '../utils'
/**
* Inline Lexer & Compiler
*/
function Inline... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/renderer.js | src/muya/lib/parser/marked/renderer.js | import defaultOptions from './options'
import { cleanUrl, escape } from './utils'
/**
* Renderer
*/
function Renderer (options = {}) {
this.options = options || defaultOptions
}
Renderer.prototype.frontmatter = function (text) {
return `<pre class="front-matter">\n${text}</pre>\n`
}
Renderer.prototype.multipl... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/options.js | src/muya/lib/parser/marked/options.js | export default {
baseUrl: null,
breaks: false,
gfm: true,
headerIds: true,
headerPrefix: '',
highlight: null,
mathRenderer: null,
emojiRenderer: null,
tocRenderer: null,
langPrefix: 'language-',
mangle: true,
pedantic: false,
renderer: null, // new Renderer(),
silent: false,
smartLists: fa... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/parser.js | src/muya/lib/parser/marked/parser.js | import Renderer from './renderer'
import InlineLexer from './inlineLexer'
import Slugger from './slugger'
import TextRenderer from './textRenderer'
import defaultOptions from './options'
/**
* Parsing & Compiling
*/
function Parser (options) {
this.tokens = []
this.token = null
this.footnotes = null
this.fo... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/marked/utils.js | src/muya/lib/parser/marked/utils.js | /**
* Helpers
*/
let uniqueIdCounter = 0
export const getUniqueId = () => ++uniqueIdCounter
export const escape = function escape (html, encode) {
if (encode) {
if (escape.escapeTest.test(html)) {
return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch] })
}
} else... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/plantuml.js | src/muya/lib/parser/render/plantuml.js | import zlib from 'zlib'
import { toHTML, h } from './snabbdom'
const PLANTUML_URL = 'https://www.plantuml.com/plantuml'
function replaceChar (tableIn, tableOut, char) {
const charIndex = tableIn.indexOf(char)
return tableOut[charIndex]
}
function maketrans (tableIn, tableOut, value) {
return [...value].map(i =... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/sequence.js | src/muya/lib/parser/render/sequence.js |
import Diagram from '../../assets/libs/sequence-diagram-snap'
import '../../assets/styles/sequence-diagram.css'
export default Diagram
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/index.js | src/muya/lib/parser/render/index.js | import loadRenderer from '../../renderers'
import { CLASS_OR_ID, PREVIEW_DOMPURIFY_CONFIG } from '../../config'
import { conflict, mixins, camelToSnake, sanitize } from '../../utils'
import { patch, toVNode, toHTML, h } from './snabbdom'
import { beginRules } from '../rules'
import renderInlines from './renderInlines'
... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/snabbdom.js | src/muya/lib/parser/render/snabbdom.js | import {
init,
classModule,
attributesModule,
datasetModule,
propsModule,
styleModule,
eventListenersModule,
h as sh,
toVNode as sToVNode
} from 'snabbdom'
export const patch = init([
classModule,
attributesModule,
styleModule,
propsModule,
datasetModule,
eventListenersModule
])
export c... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/em.js | src/muya/lib/parser/render/renderInlines/em.js | export default function em (h, cursor, block, token, outerClass) {
return this.delEmStrongFac('em', h, cursor, block, token, outerClass)
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/header.js | src/muya/lib/parser/render/renderInlines/header.js | import { CLASS_OR_ID } from '../../../config'
export default function header (h, cursor, block, token, outerClass) {
const { content } = token
const { start, end } = token.range
const className = this.getClassName(outerClass, block, {
range: {
start,
end: end - content.length
}
}, cursor)
... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/hardLineBreak.js | src/muya/lib/parser/render/renderInlines/hardLineBreak.js | import { CLASS_OR_ID } from '../../../config'
export default function softLineBreak (h, cursor, block, token, outerClass) {
const { spaces, lineBreak, isAtEnd } = token
const className = CLASS_OR_ID.AG_HARD_LINE_BREAK
const spaceClass = CLASS_OR_ID.AG_HARD_LINE_BREAK_SPACE
if (isAtEnd) {
return [
h(`... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/referenceImage.js | src/muya/lib/parser/render/renderInlines/referenceImage.js | import { CLASS_OR_ID } from '../../../config'
import { getImageInfo } from '../../../utils'
// reference_image
export default function referenceImage (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const imageClass = CLASS_OR_ID.AG_IMAGE_MARKED_TEXT
c... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/htmlRuby.js | src/muya/lib/parser/render/renderInlines/htmlRuby.js | import { CLASS_OR_ID } from '../../../config'
import { htmlToVNode } from '../snabbdom'
export default function htmlRuby (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { children } = token
const { start, end } = token.range
const content = th... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/emoji.js | src/muya/lib/parser/render/renderInlines/emoji.js | import { CLASS_OR_ID } from '../../../config'
import { validEmoji } from '../../../ui/emojis'
// render token of emoji to vdom
export default function emoji (h, cursor, block, token, outerClass) {
const { start: rStart, end: rEnd } = token.range
const className = this.getClassName(outerClass, block, token, cursor)... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/backlashInToken.js | src/muya/lib/parser/render/renderInlines/backlashInToken.js | import { union, isEven } from '../../../utils'
import { CLASS_OR_ID } from '../../../config'
// TODO HIGHLIGHT
export default function backlashInToken (h, backlashes, outerClass, start, token) {
const { highlights = [] } = token
const chunks = backlashes.split('')
const len = chunks.length
const result = []
l... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/autoLinkExtension.js | src/muya/lib/parser/render/renderInlines/autoLinkExtension.js | import { CLASS_OR_ID } from '../../../config'
import { sanitizeHyperlink } from '../../../utils/url'
// render auto_link to vdom
export default function autoLinkExtension (h, cursor, block, token, outerClass) {
const { linkType, www, url, email } = token
const { start, end } = token.range
const content = this.h... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/delEmStringFactory.js | src/muya/lib/parser/render/renderInlines/delEmStringFactory.js | import { CLASS_OR_ID } from '../../../config'
import { snakeToCamel } from '../../../utils'
// render factory of `del`,`em`,`strong`
export default function delEmStrongFac (type, h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const COMMON_MARKER = `span... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/del.js | src/muya/lib/parser/render/renderInlines/del.js | export default function del (h, cursor, block, token, outerClass) {
return this.delEmStrongFac('del', h, cursor, block, token, outerClass)
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/referenceLink.js | src/muya/lib/parser/render/renderInlines/referenceLink.js | import { CLASS_OR_ID } from '../../../config'
import { snakeToCamel } from '../../../utils'
import { sanitizeHyperlink } from '../../../utils/url'
export default function referenceLink (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const labelClass = c... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/referenceDefinition.js | src/muya/lib/parser/render/renderInlines/referenceDefinition.js | import { CLASS_OR_ID } from '../../../config'
export default function referenceDefinition (h, cursor, block, token, outerClass) {
const className = CLASS_OR_ID.AG_REFERENCE_MARKER
const {
leftBracket,
label,
backlash,
// rightBracket,
// leftHrefMarker,
// href,
// rightHrefMarker,
... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/htmlEscape.js | src/muya/lib/parser/render/renderInlines/htmlEscape.js | import { CLASS_OR_ID } from '../../../config'
import escapeCharactersMap from '../../escapeCharacter'
export default function htmlEscape (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { escapeCharacter } = token
const { start, end } = token.ran... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/index.js | src/muya/lib/parser/render/renderInlines/index.js | import backlashInToken from './backlashInToken'
import backlash from './backlash'
import highlight from './highlight'
import header from './header'
import link from './link'
import htmlTag from './htmlTag'
import hr from './hr'
import tailHeader from './tailHeader'
import hardLineBreak from './hardLineBreak'
import sof... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/inlineCode.js | src/muya/lib/parser/render/renderInlines/inlineCode.js | import { CLASS_OR_ID } from '../../../config'
export default function inlineCode (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { marker } = token
const { start, end } = token.range
const startMarker = this.highlight(h, block, start, start +... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/footnoteIdentifier.js | src/muya/lib/parser/render/renderInlines/footnoteIdentifier.js | import { CLASS_OR_ID } from '../../../config'
export default function footnoteIdentifier (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { marker } = token
const { start, end } = token.range
const startMarker = this.highlight(h, block, start,... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/inlineMath.js | src/muya/lib/parser/render/renderInlines/inlineMath.js | import katex from 'katex'
import 'katex/dist/contrib/mhchem.min.js'
import { CLASS_OR_ID } from '../../../config'
import { htmlToVNode } from '../snabbdom'
import 'katex/dist/katex.min.css'
export default function displayMath (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, bl... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/link.js | src/muya/lib/parser/render/renderInlines/link.js | import { CLASS_OR_ID } from '../../../config'
import { isLengthEven, snakeToCamel } from '../../../utils'
import { sanitizeHyperlink } from '../../../utils/url'
// 'link': /^(\[)((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*?)(\\*)\]\((.*?)(\\*)\)/, // can nest
export default function link (h, cursor, block, token, outerClas... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/hr.js | src/muya/lib/parser/render/renderInlines/hr.js | import { CLASS_OR_ID } from '../../../config'
export default function hr (h, cursor, block, token, outerClass) {
const { start, end } = token.range
const content = this.highlight(h, block, start, end, token)
return [
h(`span.${CLASS_OR_ID.AG_GRAY}.${CLASS_OR_ID.AG_REMOVE}`, content)
]
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/softLineBreak.js | src/muya/lib/parser/render/renderInlines/softLineBreak.js | import { CLASS_OR_ID } from '../../../config'
export default function hardLineBreak (h, cursor, block, token, outerClass) {
const { lineBreak, isAtEnd } = token
let selector = `span.${CLASS_OR_ID.AG_SOFT_LINE_BREAK}`
if (isAtEnd) {
selector += `.${CLASS_OR_ID.AG_LINE_END}`
}
return [
h(selector, lin... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/tailHeader.js | src/muya/lib/parser/render/renderInlines/tailHeader.js | export default function tailHeader (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { start, end } = token.range
const content = this.highlight(h, block, start, end, token)
if (/^h\d$/.test(block.type)) {
return [
h(`span.${className}`... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/multipleMath.js | src/muya/lib/parser/render/renderInlines/multipleMath.js | import { CLASS_OR_ID } from '../../../config'
export default function multipleMath (h, cursor, block, token, outerClass) {
const { start, end } = token.range
const content = this.highlight(h, block, start, end, token)
return [
h(`span.${CLASS_OR_ID.AG_GRAY}.${CLASS_OR_ID.AG_REMOVE}`, content)
]
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/codeFense.js | src/muya/lib/parser/render/renderInlines/codeFense.js | import { CLASS_OR_ID } from '../../../config'
export default function codeFense (h, cursor, block, token, outerClass) {
const { start, end } = token.range
const { marker } = token
const markerContent = this.highlight(h, block, start, start + marker.length, token)
const content = this.highlight(h, block, start... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/loadImageAsync.js | src/muya/lib/parser/render/renderInlines/loadImageAsync.js | import { getUniqueId, loadImage } from '../../../utils'
import { insertAfter, operateClassName } from '../../../utils/domManipulate'
import { CLASS_OR_ID } from '../../../config'
export default function loadImageAsync (imageInfo, attrs, className, imageClass) {
const { src, isUnknownType } = imageInfo
let id
let... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/highlight.js | src/muya/lib/parser/render/renderInlines/highlight.js | import { union } from '../../../utils'
// change text to highlight vdom
export default function highlight (h, block, rStart, rEnd, token) {
const { text } = block
const { highlights } = token
let result = []
const unions = []
let pos = rStart
if (highlights) {
for (const light of highlights) {
c... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/autoLink.js | src/muya/lib/parser/render/renderInlines/autoLink.js | import { CLASS_OR_ID } from '../../../config'
import { sanitizeHyperlink } from '../../../utils/url'
// render auto_link to vdom
export default function autoLink (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { isLink, marker, href, email } = tok... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/superSubScript.js | src/muya/lib/parser/render/renderInlines/superSubScript.js | import { CLASS_OR_ID } from '../../../config'
export default function superSubScript (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { marker } = token
const { start, end } = token.range
const startMarker = this.highlight(h, block, start, sta... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/backlash.js | src/muya/lib/parser/render/renderInlines/backlash.js | import { CLASS_OR_ID } from '../../../config'
export default function backlash (h, cursor, block, token, outerClass) {
const className = this.getClassName(outerClass, block, token, cursor)
const { start, end } = token.range
const content = this.highlight(h, block, start, end, token)
return [
h(`span.${cla... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/image.js | src/muya/lib/parser/render/renderInlines/image.js | import { CLASS_OR_ID } from '../../../config'
import { getImageInfo } from '../../../utils'
import ImageIcon from '../../../assets/pngicon/image/2.png'
import ImageFailIcon from '../../../assets/pngicon/image_fail/2.png'
import DeleteIcon from '../../../assets/pngicon/delete/2.png'
const renderIcon = (h, className, ic... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/htmlTag.js | src/muya/lib/parser/render/renderInlines/htmlTag.js | import { CLASS_OR_ID, BLOCK_TYPE6 } from '../../../config'
import { snakeToCamel } from '../../../utils'
import sanitize, { isValidAttribute } from '../../../utils/dompurify'
export default function htmlTag (h, cursor, block, token, outerClass) {
const { tag, openTag, closeTag, children, attrs } = token
const clas... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/strong.js | src/muya/lib/parser/render/renderInlines/strong.js | export default function strong (h, cursor, block, token, outerClass) {
return this.delEmStrongFac('strong', h, cursor, block, token, outerClass)
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderInlines/text.js | src/muya/lib/parser/render/renderInlines/text.js | // render token of text type to vdom.
export default function text (h, cursor, block, token) {
const { start, end } = token.range
return [
h('span.ag-plain-text', this.highlight(h, block, start, end, token))
]
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderLineNumber.js | src/muya/lib/parser/render/renderBlock/renderLineNumber.js | import { h } from '../snabbdom'
const NEW_LINE_EXP = /\n(?!$)/g
const renderLineNumberRows = codeContent => {
const { text } = codeContent
const match = text.match(NEW_LINE_EXP)
let linesNum = match ? match.length + 1 : 1
if (text.endsWith('\n')) {
linesNum++
}
const data = {
attrs: {
'aria-... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderCopyButton.js | src/muya/lib/parser/render/renderBlock/renderCopyButton.js | import { h } from '../snabbdom'
import copyIcon from '../../../assets/pngicon/copy/2.png'
const renderCopyButton = () => {
const selector = 'a.ag-code-copy'
const iconVnode = h('i.icon', h('i.icon-inner', {
style: {
background: `url(${copyIcon}) no-repeat`,
'background-size': '100%'
}
}, ''))... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/index.js | src/muya/lib/parser/render/renderBlock/index.js | import renderBlock from './renderBlock'
import renderLeafBlock from './renderLeafBlock'
import renderContainerBlock from './renderContainerBlock'
import renderIcon from './renderIcon'
export default {
renderBlock,
renderLeafBlock,
renderContainerBlock,
renderIcon
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderContainerBlock.js | src/muya/lib/parser/render/renderBlock/renderContainerBlock.js | import { CLASS_OR_ID } from '../../../config'
import { renderTableTools } from './renderToolBar'
import { footnoteJumpIcon } from './renderFootnoteJump'
import { renderEditIcon } from './renderContainerEditIcon'
// import renderLineNumberRows from './renderLineNumber'
import renderCopyButton from './renderCopyButton'
i... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderContainerEditIcon.js | src/muya/lib/parser/render/renderBlock/renderContainerEditIcon.js | import { h } from '../snabbdom'
import { CLASS_OR_ID } from '../../../config'
import htmlIcon from '../../../assets/pngicon/html/2.png'
export const renderEditIcon = () => {
const selector = `a.${CLASS_OR_ID.AG_CONTAINER_ICON}`
const iconVnode = h('i.icon', h('i.icon-inner', {
style: {
background: `url($... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderFootnoteJump.js | src/muya/lib/parser/render/renderBlock/renderFootnoteJump.js | import { h } from '../snabbdom'
export const footnoteJumpIcon = () => {
return h('i.ag-footnote-backlink', '↩︎')
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderIcon.js | src/muya/lib/parser/render/renderBlock/renderIcon.js | import { h } from '../snabbdom'
import { CLASS_OR_ID } from '../../../config'
import paragraphIcon from '../../../assets/pngicon/paragraph/2.png'
import htmlIcon from '../../../assets/pngicon/html/2.png'
import hrIcon from '../../../assets/pngicon/horizontal_line/2.png'
import frontMatterIcon from '../../../assets/pngi... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderLeafBlock.js | src/muya/lib/parser/render/renderBlock/renderLeafBlock.js | import katex from 'katex'
import prism, { loadedLanguages, transformAliasToOrigin } from '../../../prism/'
import 'katex/dist/contrib/mhchem.min.js'
import { CLASS_OR_ID, DEVICE_MEMORY, PREVIEW_DOMPURIFY_CONFIG, HAS_TEXT_BLOCK_REG } from '../../../config'
import { tokenizer } from '../../'
import { snakeToCamel, saniti... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderTableDargBar.js | src/muya/lib/parser/render/renderBlock/renderTableDargBar.js | import { h } from '../snabbdom'
export const renderLeftBar = () => {
return h('span.ag-drag-handler.left', {
attrs: { contenteditable: 'false' }
})
}
export const renderBottomBar = () => {
return h('span.ag-drag-handler.bottom', {
attrs: { contenteditable: 'false' }
})
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderToolBar.js | src/muya/lib/parser/render/renderBlock/renderToolBar.js | // used for render table tookbar or others.
import { h } from '../snabbdom'
import { CLASS_OR_ID } from '../../../config'
import TableIcon from '../../../assets/pngicon/table/table@2x.png'
import AlignLeftIcon from '../../../assets/pngicon/algin_left/2.png'
import AlignRightIcon from '../../../assets/pngicon/algin_righ... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/muya/lib/parser/render/renderBlock/renderBlock.js | src/muya/lib/parser/render/renderBlock/renderBlock.js | /**
* [renderBlock render one block, no matter it is a container block or text block]
*/
export default function renderBlock (parent, block, activeBlocks, matches, useCache = false) {
const method = Array.isArray(block.children) && block.children.length > 0
? 'renderContainerBlock'
: 'renderLeafBlock'
re... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/common/envPaths.js | src/common/envPaths.js | import path from 'path'
class EnvPaths {
/**
* @param {string} userDataPath The user data path.
* @returns
*/
constructor (userDataPath) {
const currentDate = new Date()
if (!userDataPath) {
throw new Error('"userDataPath" is not set.')
}
this._electronUserDataPath = userDataPath //... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/common/encoding.js | src/common/encoding.js | export const ENCODING_NAME_MAP = Object.freeze({
utf8: 'UTF-8',
utf16be: 'UTF-16 BE',
utf16le: 'UTF-16 LE',
utf32be: 'UTF-32 BE',
utf32le: 'UTF-32 LE',
ascii: 'Western (ISO 8859-1)',
latin3: 'Western (ISO 8859-3)',
iso885915: 'Western (ISO 8859-15)',
cp1252: 'Western (Windows 1252)',
arabic: 'Arabic... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/common/commands/constants.js | src/common/commands/constants.js | const COMMANDS = Object.freeze({
EDIT_COPY: 'edit.copy',
EDIT_COPY_AS_HTML: 'edit.copy-as-html',
EDIT_COPY_AS_MARKDOWN: 'edit.copy-as-markdown',
EDIT_CREATE_PARAGRAPH: 'edit.create-paragraph',
EDIT_CUT: 'edit.cut',
EDIT_DELETE_PARAGRAPH: 'edit.delete-paragraph',
EDIT_DUPLICATE: 'edit.duplicate',
EDIT_FI... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/common/filesystem/index.js | src/common/filesystem/index.js | import fs from 'fs-extra'
import fsPromises from 'fs/promises'
import path from 'path'
/**
* Test whether or not the given path exists.
*
* @param {string} p The path to the file or directory.
* @returns {boolean}
*/
export const exists = async p => {
try {
await fsPromises.access(p)
return true
} cat... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/common/filesystem/paths.js | src/common/filesystem/paths.js | import fs from 'fs'
import path from 'path'
import { isFile, isFile2, isSymbolicLink } from './index'
const isOsx = process.platform === 'darwin'
export const MARKDOWN_EXTENSIONS = Object.freeze([
'markdown',
'mdown',
'mkdn',
'md',
'mkd',
'mdwn',
'mdtxt',
'mdtext',
'mdx',
'text',
'txt'
])
expor... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/common/keybinding/index.js | src/common/keybinding/index.js | const isOsx = process.platform === 'darwin'
const _normalizeAccelerator = accelerator => {
return accelerator.toLowerCase()
.replace('commandorcontrol', isOsx ? 'cmd' : 'ctrl')
.replace('cmdorctrl', isOsx ? 'cmd' : 'ctrl')
.replace('control', 'ctrl')
.replace('meta', 'cmd') // meta := cmd (macOS only... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/index.js | src/main/index.js | import './globalSetting'
import path from 'path'
import { app, dialog } from 'electron'
import { initialize as remoteInitializeServer } from '@electron/remote/main'
import cli from './cli'
import setupExceptionHandler, { initExceptionLogger } from './exceptionHandler'
import log from 'electron-log'
import App from './a... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/config.js | src/main/config.js | export const isOsx = process.platform === 'darwin'
export const isWindows = process.platform === 'win32'
export const isLinux = process.platform === 'linux'
export const editorWinOptions = Object.freeze({
minWidth: 550,
minHeight: 350,
webPreferences: {
contextIsolation: false,
// WORKAROUND: We cannot e... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/index.dev.js | src/main/index.dev.js | /**
* This file is used specifically and only for development. It installs
* `vue-devtools`. There shouldn't be any need to modify this file,
* but it can be used to extend your development environment.
*/
/* eslint-disable */
require('dotenv').config()
// Install `vue-devtools`
require('electron').app.on('ready'... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/globalSetting.js | src/main/globalSetting.js | import path from 'path'
// Set `__static` path to static files in production.
if (process.env.NODE_ENV !== 'development') {
global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/exceptionHandler.js | src/main/exceptionHandler.js | // Based on electron-unhandled by sindresorhus:
//
// MIT License
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software witho... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/dataCenter/index.js | src/main/dataCenter/index.js | import fs from 'fs'
import path from 'path'
import EventEmitter from 'events'
import { BrowserWindow, ipcMain, dialog } from 'electron'
import keytar from 'keytar'
import schema from './schema'
import Store from 'electron-store'
import log from 'electron-log'
import { ensureDirSync } from 'common/filesystem'
import { I... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/app/accessor.js | src/main/app/accessor.js | import WindowManager from '../app/windowManager'
import Preference from '../preferences'
import DataCenter from '../dataCenter'
import Keybindings from '../keyboard/shortcutHandler'
import AppMenu from '../menu'
import { loadMenuCommands } from '../menu/actions'
import { CommandManager, loadDefaultCommands } from '../c... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/app/env.js | src/main/app/env.js | import path from 'path'
import AppPaths, { ensureAppDirectoriesSync } from './paths'
let envId = 0
const patchEnvPath = () => {
if (process.platform === 'darwin') {
process.env.PATH += (process.env.PATH.endsWith(path.delimiter) ? '' : path.delimiter) + '/Library/TeX/texbin'
}
}
export class AppEnvironment {
... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/app/index.js | src/main/app/index.js | import path from 'path'
import fsPromises from 'fs/promises'
import { exec } from 'child_process'
import dayjs from 'dayjs'
import log from 'electron-log'
import { app, BrowserWindow, clipboard, dialog, ipcMain, nativeTheme, shell } from 'electron'
import { isChildOfDirectory } from 'common/filesystem/paths'
import { i... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/app/windowManager.js | src/main/app/windowManager.js | import { app, BrowserWindow, ipcMain } from 'electron'
import EventEmitter from 'events'
import log from 'electron-log'
import Watcher, { WATCHER_STABILITY_THRESHOLD, WATCHER_STABILITY_POLL_INTERVAL } from '../filesystem/watcher'
import { WindowType } from '../windows/base'
class WindowActivityList {
constructor () ... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/app/paths.js | src/main/app/paths.js | import { app } from 'electron'
import EnvPaths from 'common/envPaths'
import { ensureDirSync } from 'common/filesystem'
class AppPaths extends EnvPaths {
/**
* Configure and sets all application paths.
*
* @param {[string]} userDataPath The user data path or null.
*/
constructor (userDataPath = '') {
... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/contextMenu/editor/spellcheck.js | src/main/contextMenu/editor/spellcheck.js | import { ipcMain, MenuItem } from 'electron'
import log from 'electron-log'
import { isOsx } from '../../config'
import { addToDictionary } from '../../spellchecker'
import { SEPARATOR } from './menuItems'
/**
* Build the spell checker menu depending on input.
*
* @param {boolean} isMisspelled Whether a the selecte... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/contextMenu/editor/index.js | src/main/contextMenu/editor/index.js | import { Menu, MenuItem } from 'electron'
import {
CUT,
COPY,
PASTE,
COPY_AS_MARKDOWN,
COPY_AS_HTML,
PASTE_AS_PLAIN_TEXT,
SEPARATOR,
INSERT_BEFORE,
INSERT_AFTER
} from './menuItems'
import spellcheckMenuBuilder from './spellcheck'
const CONTEXT_ITEMS = [INSERT_BEFORE, INSERT_AFTER, SEPARATOR, CUT, CO... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/contextMenu/editor/menuItems.js | src/main/contextMenu/editor/menuItems.js | // NOTE: This are mutable fields that may change at runtime.
export const CUT = {
label: 'Cut',
id: 'cutMenuItem',
role: 'cut'
}
export const COPY = {
label: 'Copy',
id: 'copyMenuItem',
role: 'copy'
}
export const PASTE = {
label: 'Paste',
id: 'pasteMenuItem',
role: 'paste'
}
export const COPY_AS_... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/commands/tab.js | src/main/commands/tab.js | import { COMMANDS } from './index'
const switchToLeftTab = win => {
if (win && win.webContents) {
win.webContents.send('mt::tabs-cycle-left')
}
}
const switchToRightTab = win => {
if (win && win.webContents) {
win.webContents.send('mt::tabs-cycle-right')
}
}
const switchTabByIndex = (win, index) => {... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/commands/index.js | src/main/commands/index.js | import COMMAND_CONSTANTS from 'common/commands/constants'
import { loadFileCommands } from './file'
import { loadTabCommands } from './tab'
export const COMMANDS = COMMAND_CONSTANTS
export const loadDefaultCommands = commandManager => {
loadFileCommands(commandManager)
loadTabCommands(commandManager)
}
class Com... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/commands/file.js | src/main/commands/file.js | import { COMMANDS } from './index'
const openQuickOpenDialog = win => {
if (win && win.webContents) {
win.webContents.send('mt::execute-command-by-id', 'file.quick-open')
}
}
export const loadFileCommands = commandManager => {
commandManager.add(COMMANDS.FILE_QUICK_OPEN, openQuickOpenDialog)
}
| javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/utils/createGitHubIssue.js | src/main/utils/createGitHubIssue.js | import { shell } from 'electron'
import { GITHUB_REPO_URL } from '../config'
export const createGitHubIssueUrl = (title, msg) => {
const issueUrl = new URL(`${GITHUB_REPO_URL}/issues/new`)
if (title) {
issueUrl.searchParams.set('title', title)
}
if (msg) {
issueUrl.searchParams.set('body', msg)
}
r... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/utils/imagePathAutoComplement.js | src/main/utils/imagePathAutoComplement.js | import fs from 'fs'
import path from 'path'
import { filter } from 'fuzzaldrin'
import log from 'electron-log'
import { isDirectory, isFile } from 'common/filesystem'
import { IMAGE_EXTENSIONS } from 'common/filesystem/paths'
import { BLACK_LIST } from '../config'
// TODO(need::refactor): Refactor this file. Just retu... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/utils/index.js | src/main/utils/index.js | import { app } from 'electron'
const ID_PREFIX = 'mt-'
let id = 0
export const getUniqueId = () => {
return `${ID_PREFIX}${id++}`
}
// TODO: Remove this function and load the recommend title from the editor (renderer) when
// requesting the document to save/export.
export const getRecommendTitleFromMarkdownString ... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/utils/pandoc.js | src/main/utils/pandoc.js | // Copy from https://github.com/utatti/simple-pandoc/blob/master/index.js
import { spawn } from 'child_process'
import commandExists from 'command-exists'
import { isFile2 } from 'common/filesystem'
const pandocCommand = 'pandoc'
const getCommand = () => {
if (envPathExists()) {
return process.env.MARKTEXT_PAND... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/filesystem/index.js | src/main/filesystem/index.js | import fs from 'fs-extra'
import path from 'path'
import { isDirectory, isFile, isSymbolicLink } from 'common/filesystem'
/**
* Normalize the path into an absolute path and resolves the link target if needed.
*
* @param {string} pathname The path or link path.
* @returns {string} Returns the absolute path and reso... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/filesystem/markdown.js | src/main/filesystem/markdown.js | import fsPromises from 'fs/promises'
import path from 'path'
import log from 'electron-log'
import iconv from 'iconv-lite'
import { LINE_ENDING_REG, LF_LINE_ENDING_REG, CRLF_LINE_ENDING_REG } from '../config'
import { isDirectory2 } from 'common/filesystem'
import { isMarkdownFile } from 'common/filesystem/paths'
impor... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/filesystem/watcher.js | src/main/filesystem/watcher.js | import path from 'path'
import fsPromises from 'fs/promises'
import log from 'electron-log'
import chokidar from 'chokidar'
import { exists } from 'common/filesystem'
import { hasMarkdownExtension } from 'common/filesystem/paths'
import { getUniqueId } from '../utils'
import { loadMarkdownFile } from '../filesystem/mar... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
marktext/marktext | https://github.com/marktext/marktext/blob/aa71e33e07845419533d767ad0d260a7c267cec7/src/main/filesystem/encoding.js | src/main/filesystem/encoding.js | import ced from 'ced'
const CED_ICONV_ENCODINGS = {
'BIG5-CP950': 'big5',
KSC: 'euckr',
'ISO-2022-KR': 'euckr',
GB: 'gb2312',
ISO_2022_CN: 'gb2312',
JIS: 'shiftjis',
SJS: 'shiftjis',
Unicode: 'utf8',
// Map ASCII to UTF-8
'ASCII-7-bit': 'utf8',
ASCII: 'utf8',
MACINTOSH: 'utf8'
}
// Byte Order... | javascript | MIT | aa71e33e07845419533d767ad0d260a7c267cec7 | 2026-01-04T14:57:09.944492Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.