function markedHighlight(t){if("function"==typeof t&&(t={highlight:t}),!t||"function"!=typeof t.highlight)throw new Error("Must provide highlight function");return"string"!=typeof t.langPrefix&&(t.langPrefix="language-"),{async:!!t.async,walkTokens(e){if("code"!==e.type)return;const n=getLang(e.lang);if(t.async)return Promise.resolve(t.highlight(e.text,n,e.lang||"")).then(updateToken(e));const i=t.highlight(e.text,n,e.lang||"");if(i instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");updateToken(e)(i)},renderer:{code(e,n,i){const o=getLang(n),r=o?` class="${t.langPrefix}${escape(o)}"`:' class="hljs"';return e=e.replace(/\n$/,""),`<pre><code${r}>${i?e:escape(e,!0)}\n</code></pre>`}}}}function getLang(t){return(t||"").match(/\S*/)[0]}function updateToken(t){return e=>{"string"==typeof e&&e!==t.text&&(t.escaped=!0,t.text=e)}}