diff --git a/public/index.html b/public/index.html index 312742b..4d05521 100644 --- a/public/index.html +++ b/public/index.html @@ -33,6 +33,8 @@ + + \ No newline at end of file diff --git a/public/script.js b/public/script.js index cc349cf..ddbf27f 100644 --- a/public/script.js +++ b/public/script.js @@ -39,7 +39,7 @@ function write_message(data) { if (!data.plain) { rendered_message = md.render(message); } else { - rendered_message = `
${message}
`; + rendered_message = `${message}`; } rendered_message = DOMPurify.sanitize(rendered_message); @@ -67,7 +67,22 @@ async function init() { clear_message(); await login_name(); - md = new remarkable.Remarkable(); + md = new remarkable.Remarkable({ + highlight: function (str, lang) { + if (lang && hljs.getLanguage(lang)) { + try { + return hljs.highlight(lang, str).value; + } catch (err) { } + } + + try { + return hljs.highlightAuto(str).value; + } catch (err) { } + + return ''; + } + }); + md.inline.ruler.enable(['mark', 'sup', 'sub']); const ws = new io(server); diff --git a/public/style.css b/public/style.css index 8ee7736..17c36b4 100644 --- a/public/style.css +++ b/public/style.css @@ -60,7 +60,7 @@ pre { font-size: 17px; padding: 30px; width: 100vw; - height: 30vh; + height: calc(30vh - 100px); box-shadow: 0 1px 3px rgba(50, 50, 93, .15), 0 1px 0 rgba(0, 0, 0, .02); } @@ -169,4 +169,4 @@ pre { #confirm-prompt { float: right; margin-top: 15px; -} \ No newline at end of file +}