From aca1f604eda2621c4b70ed8159574da3f27276ca Mon Sep 17 00:00:00 2001 From: Hristijan Gliguroski Date: Fri, 21 Jun 2024 18:33:17 +0200 Subject: [PATCH] added headings support --- assets/css/index.css | 13 +++++++++++++ assets/js/script.js | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/assets/css/index.css b/assets/css/index.css index cfba40b..0292a46 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -2922,4 +2922,17 @@ body.single .top>.gui .item.guiEmbedName { .guiEmbedAdd .icon { margin-right: 7px; +} + +.heading1 { + font-size: 24px; + font-weight: bold; +} +.heading2 { + font-size: 20px; + font-weight: bold; +} +.heading3 { + font-size: 16px; + font-weight: bold; } \ No newline at end of file diff --git a/assets/js/script.js b/assets/js/script.js index 01b3aaa..d8b8f9f 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -439,6 +439,10 @@ addEventListener('DOMContentLoaded', () => { .replace(/__(.+?)__/g, '$1') .replace(/\*(.+?)\*/g, '$1') .replace(/_(.+?)_/g, '$1') + //headings + .replace(/^# (.*)$/gm, '

$1

') + .replace(/^## (.*)$/gm, '

$1

') + .replace(/^### (.*)$/gm, '

$1

') // Replace >>> and > with block-quotes. > is HTML code for > .replace(/^(?: *>>> ([\s\S]*))|(?:^ *>(?!>>) +.+\n)+(?:^ *>(?!>>) .+\n?)+|^(?: *>(?!>>) ([^\n]*))(\n?)/mg, (all, match1, match2, newLine) => { return `
${match1 || match2 || newLine ? match1 || match2 : all.replace(/^ *> /gm, '')}
`;