MCPcopy
hub / github.com/marktext/marktext / highlight

Method highlight

packages/muyajs/lib/utils/exportHtml.js:140–156  ·  view source on GitHub ↗
(code, lang)

Source from the content-addressed store, hash-verified

138 ? this.muya.options.isGitlabCompatibilityEnabled
139 : false,
140 highlight(code, lang) {
141 // Language may be undefined (GH#591)
142 if (!lang) {
143 return code
144 }
145
146 if (DIAGRAM_TYPE.includes(lang)) {
147 return code
148 }
149
150 const grammar = Prism.languages[lang]
151 if (!grammar) {
152 console.warn(`Unable to find grammar for "${lang}".`)
153 return code
154 }
155 return Prism.highlight(code, grammar, lang)
156 },
157 emojiRenderer(emoji) {
158 const validate = validEmoji(emoji)
159 if (validate) {

Callers 15

highlightFunction · 0.80
textFunction · 0.80
htmlTagFunction · 0.80
superSubScriptFunction · 0.80
htmlRubyFunction · 0.80
multipleMathFunction · 0.80
inlineCodeFunction · 0.80
footnoteIdentifierFunction · 0.80
headerFunction · 0.80
delEmStrongFacFunction · 0.80
referenceDefinitionFunction · 0.80
autoLinkExtensionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected