Skip to content

Commit

Permalink
Bugfixes in md-to-html
Browse files Browse the repository at this point in the history
  • Loading branch information
magicianessuwu committed Apr 28, 2024
1 parent c100462 commit 6983338
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions scripts/markdown_to_html_turner.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ document.addEventListener("DOMContentLoaded", function () {
var bananaDiv = bananaDivs[bananaDivs.length - 1];

// Check if line is empty
bananaDiv.innerHTML += "<br>";
if (lines[i].trim() === "") {
// If line is empty, add <br> tag
bananaDiv.appendChild(document.createElement("br"));
bananaDiv.innerHTML += "";
} else {
// If line is not empty, add text inside banana div
bananaDiv.innerHTML += lines[i].replace(/\[([^\]]+)\]\(([^\)]+)\)/g, '<a href="$2">$1</a>'); + "<br>"; // Add new line
if (lines[i].startsWith("## ") || lines[i].startsWith("### ") || lines[i].startsWith("### ")) {
bananaDiv.innerHTML += "<span class=\"heading\">"+lines[i]+"</span>";
} else {
bananaDiv.innerHTML += lines[i].replace(/\[([^\]]+)\]\(([^\)]+)\)/g, '<a href="$2">$1</a>'); // Add new line
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ nav {
}

a {
color: #a090f0;
color: #9090ff;
}

main {
Expand Down Expand Up @@ -243,4 +243,8 @@ main img {

#turn_this_markdown_to_html_pretty_please img {
width: max-content;
}

.heading {
color: #30ff30;
}

0 comments on commit 6983338

Please sign in to comment.