mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
refactor: remove duplicate escape functions; improve escapeHtml function
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import hljs from 'highlight.js';
|
||||
import { escapeHtml } from '../utils/html';
|
||||
|
||||
type HighlightRequest = {
|
||||
id: number;
|
||||
@@ -11,9 +12,6 @@ type HighlightResponse = {
|
||||
html: string;
|
||||
};
|
||||
|
||||
const escapeHtml = (value: string) =>
|
||||
value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
|
||||
self.onmessage = (event: MessageEvent<HighlightRequest>) => {
|
||||
const { id, code, lang } = event.data;
|
||||
let html = '';
|
||||
|
||||
Reference in New Issue
Block a user