0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-29 02:44:08 -05:00
forgejo/web_src/js/features/highlight.worker.js

13 lines
371 B
JavaScript
Raw Normal View History

import {highlightBlock} from 'highlight.js';
import {createWindow} from 'domino';
self.addEventListener('message', ({data}) => {
const window = createWindow();
self.document = window.document;
const {index, html} = data;
document.body.innerHTML = html;
highlightBlock(document.body.firstChild);
self.postMessage({index, html: document.body.innerHTML});
});