Skip to content

Commit

Permalink
Merge pull request #49 from x1xo/main
Browse files Browse the repository at this point in the history
Added headings support
  • Loading branch information
Glitchii authored Jun 21, 2024
2 parents 8dfa03f + aca1f60 commit 4bc5519
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 4 additions & 0 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ addEventListener('DOMContentLoaded', () => {
.replace(/__(.+?)__/g, '<u>$1</u>')
.replace(/\*(.+?)\*/g, '<em>$1</em>')
.replace(/_(.+?)_/g, '<em>$1</em>')
//headings
.replace(/^# (.*)$/gm, '<h1 class="heading1">$1</h1>')
.replace(/^## (.*)$/gm, '<h2 class="heading2">$1</h2>')
.replace(/^### (.*)$/gm, '<h3 class="heading3">$1</h3>')
// Replace >>> and > with block-quotes. &#62; is HTML code for >
.replace(/^(?: *&#62;&#62;&#62; ([\s\S]*))|(?:^ *&#62;(?!&#62;&#62;) +.+\n)+(?:^ *&#62;(?!&#62;&#62;) .+\n?)+|^(?: *&#62;(?!&#62;&#62;) ([^\n]*))(\n?)/mg, (all, match1, match2, newLine) => {
return `<div class="blockquote"><div class="blockquoteDivider"></div><blockquote>${match1 || match2 || newLine ? match1 || match2 : all.replace(/^ *&#62; /gm, '')}</blockquote></div>`;
Expand Down

0 comments on commit 4bc5519

Please sign in to comment.