diff --git a/front-end/index.html b/front-end/index.html
index 27a68721..46057d51 100644
--- a/front-end/index.html
+++ b/front-end/index.html
@@ -30,11 +30,15 @@
src="//lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/ionicons/4.6.3/ionicons/ionicons.js"
>
-
+
{
- let markedText;
- try {
- markedText = marked(text, {
- gfm: true,
- highlight: (code, lang, callback) => {
- return hljs.highlight(lang, code).value;
- },
- });
- } catch (e) {
- markedText = marked(text, {
- gfm: true,
- highlight: (code, lang, callback) => {
- return hljs.highlight('bash', code).value;
- },
- });
- }
+ const markedText = marked(text, {
+ gfm: true,
+ highlight: (code, language, callback) => {
+ try {
+ return hljs.highlight(code, { language, ignoreIllegals: true })
+ .value;
+ } catch (e) {
+ return hljs.highlight(code, {
+ language: 'plaintext',
+ ignoreIllegals: true,
+ }).value;
+ }
+ },
+ });
+
if (
window.backFordwardCache.current +
(window.backFordwardCache.current === '/' ? '' : '/') +
@@ -1296,21 +1309,19 @@
break;
case 'text':
sendRequest('GET', url, null, null, (data) => {
- let pre = document.createElement('pre');
- let code = document.createElement('code');
- pre.append(code);
+ const pre = document.createElement('pre');
pre.style.background = 'rgb(245,245,245)';
- pre.style['overflow-x'] = 'scroll';
- pre.classList.add(suffix);
- // content.style.textAlign = "initial";
+ pre.style.padding = '5px';
+ pre.style['overflow-x'] = 'auto';
+ content.style.textAlign = 'initial';
content.innerHTML = '';
content.append(pre);
- code.textContent = data;
+ pre.textContent = data;
if (
size.indexOf(' B') >= 0 ||
(size.indexOf(' KB') && size.split(' ')[0] < 100)
) {
- hljs.highlightBlock(pre);
+ hljs.highlightElement(pre);
}
});
break;