diff --git a/app/public/style.css b/app/public/style.css
index bc1829a..293ca64 100644
--- a/app/public/style.css
+++ b/app/public/style.css
@@ -321,12 +321,14 @@ input[type="checkbox"] {
}
/* typo */
-p {
- margin-bottom: var(--pad-4);
-}
+p,
+ul,
+ol {
+ margin-bottom: var(--pad-4) !important;
-p:last-child {
- margin-bottom: 0;
+ &:last-child {
+ margin-bottom: 0 !important;
+ }
}
.post_right:not(.repost) {
@@ -522,6 +524,11 @@ blockquote {
opacity: 75%;
}
+p,
+span {
+ font-size: inherit;
+}
+
/* codemirror/hljs */
.CodeMirror {
color: var(--color-text) !important;
@@ -660,6 +667,7 @@ blockquote {
.CodeMirror-line {
padding-left: 0 !important;
+ font-size: 16px !important;
}
.CodeMirror-focused .CodeMirror-placeholder {
diff --git a/src/markdown.rs b/src/markdown.rs
index 3bc93d5..a4a2628 100644
--- a/src/markdown.rs
+++ b/src/markdown.rs
@@ -884,6 +884,14 @@ pub fn parse_details(input: &str) -> String {
output
}
+fn underscore_chars(mut x: String, chars: &[&str]) -> String {
+ for y in chars {
+ x = x.replace(y, "_");
+ }
+
+ x
+}
+
/// Get the list of headers needed for [`parse_toc`].
pub fn get_toc_list(input: &str) -> (String, String) {
let mut output = String::new();
@@ -919,11 +927,18 @@ pub fn get_toc_list(input: &str) -> (String, String) {
let x = line.replacen(&"#".repeat(hc), "", 1);
let htext = x.trim();
- let id = htext.to_lowercase().replace(" ", "_");
- output.push_str(&format!("{htext}\n"));
+ let id = underscore_chars(
+ htext.to_lowercase(),
+ &[" ", "(", ")", "[", "]", "{", "}", ":", "?", "#", "&"],
+ );
+
+ output.push_str(&format!(
+ "{}\n",
+ render_markdown(&htext)
+ ));
// add heading to toc
- toc += &format!("{}- [{htext}](#{id})\n", " ".repeat(hc));
+ toc += &format!("{}- {htext}\n", " ".repeat(hc));
// ...
continue;
@@ -958,7 +973,7 @@ pub fn parse_toc(input: &str) -> String {
// not in pre
if line.len() == 5 && line.to_lowercase() == "[toc]" {
// add toc
- output.push_str(&toc_list);
+ output.push_str(&format!("\n{toc_list}"));
continue;
}