Code highlight
Highlighted code without an editor: the same tokenizers and colours as the code editor, rendered on the server, no engine loaded. For snippets, logs and read-only files. highlightCode(code, language) gives the tokens for your own markup.
Part of @tectra-ng/code-editor — install it separately: npm install @tectra-ng/code-editor.
Basic
Give it code and a language; the height follows the code unless you set height.
export async function retry<T>(task: () => Promise<T>, attempts = 3): Promise<T> {
for (let attempt = 1; ; attempt++) {
try {
return await task();
} catch (error) {
if (attempt >= attempts) throw error;
await new Promise((resolve) => setTimeout(resolve, 2 ** attempt * 100));
}
}
}
Options
Hide lineNumbers, turn on wordWrap for long lines, start counting at firstLine.
<footer class="site-footer">
<p>Questions about your order? Write to us any day of the week and we answer within one working day, usually faster.</p>
<a href="/contacts" class="link">Contacts</a>
</footer>