MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / backTicks

Function backTicks

plugins/grok-theme/index.mjs:46–57  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

44
45/** Utility functions extracted from the MarkdownTheme plugin */
46export function backTicks(text) {
47 // If the input string itself contains a pipe, or backslash (which can result in unwanted side effects) the string is escaped instead.
48 if (/(\||\\)/g.test(text)) {
49 return escapeChars(text);
50 }
51 // If the input string itself contains a backtick, the string is wrapped in double backticks.
52 if (/`/g.test(text)) {
53 return `\`\` ${text} \`\``;
54 }
55 // Otherwise, the string is wrapped in single backticks.
56 return `\`${text}\``;
57}
58
59class GrokThemeRenderContext extends MarkdownThemeContext {
60 constructor(theme, page, options) {

Callers 1

constructorMethod · 0.85

Calls 1

escapeCharsFunction · 0.85

Tested by

no test coverage detected