MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / fence

Function fence

src/render_html.mjs:94–99  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

92
93let renderer = {
94 fence(token) {
95 let config = /\S/.test(token.info) ? PJSON.parse(token.info) : {}
96 if (config.hidden) return "";
97 let lang = config.lang || "javascript", tab = lang == "html" || lang == "javascript" ? " tabindex=\"0\"" : ""
98 return `\n\n<pre${attrs(token)}${tab} class="snippet" data-language="${lang}" ${config.focus ? " data-focus=\"true\"" : ""}${config.sandbox ? ` data-sandbox="${config.sandbox}"` : ""}${config.meta ? ` data-meta="${config.meta}"` : ""}>${anchor(token)}${highlight(lang, token.content.trimRight())}</pre>`
99 },
100
101 hardbreak() { return `<br${close}>` },
102 softbreak() { return " " },

Callers

nothing calls this directly

Calls 3

attrsFunction · 0.85
anchorFunction · 0.85
highlightFunction · 0.85

Tested by

no test coverage detected