diff --git a/src/utils.rs b/src/utils.rs index f5046cb3..0bc0aea5 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1112,6 +1112,10 @@ pub fn rewrite_urls(input_text: &str) -> String { // Remove (html-encoded) "\" from URLs. text1 = text1.replace("%5C", "").replace("\\_", "_"); + /* Remove paragraphs that only contain zero width spaces. + Reddit ignores these in their formatting so we want to remove them so they don't mess with ours. */ + text1 = text1.replace("
", "").replace("
", ""); + // Rewrite external media previews to Redlib loop { if REDDIT_PREVIEW_REGEX.find(&text1).is_none() { diff --git a/static/style.css b/static/style.css index 608ae178..3cfc36ce 100644 --- a/static/style.css +++ b/static/style.css @@ -1210,7 +1210,6 @@ a.search_subreddit:hover { .post_body pre { background: var(--background); overflow-x: auto; - margin: 10px 0; padding: 10px; } @@ -1748,17 +1747,16 @@ input[type="submit"] { width: 100%; } -.md > p:not(:first-child) { - margin-top: 20px; +.md > :first-child { + margin-top: 0; } -.md > figure:first-of-type { - margin-top: 5px; - margin-bottom: 0px; +.md > :last-child { + margin-bottom: 0; } -.md > figure:not(:first-of-type) { - margin-top: 10px; +.md > * { + margin-bottom: 1.25rem; } .md h1 { @@ -1780,6 +1778,10 @@ input[type="submit"] { font-size: 12px; } +.md h1, h2, h3, h4, h5, h6 { + margin: 1.25rem 0 .75rem; +} + .md blockquote { padding: 10px; margin: 4px 0 4px 5px; @@ -1818,7 +1820,6 @@ input[type="submit"] { .md pre { background: var(--outside); padding: 20px; - margin-top: 10px; border-radius: 5px; box-shadow: var(--shadow); overflow: auto;