0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-10 20:11:19 +01:00
gitea/web_src/js/features/highlight.worker.js

13 lines
360 B
JavaScript
Raw Normal View History

import {highlightBlock} from 'highlight.js';
import {createWindow} from 'domino';
self.onmessage = function ({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});
};