From 9d74a28bcb383f4c9662a40d624f905ecc26f567 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Tue, 6 Mar 2018 10:24:10 +0000 Subject: [PATCH] Use for inline code,
 for code blocks

Stop breaking convention with semantic HTML and pretty much all
Markdown implementations.

This change simplifies CSS and puts HashOver in line with most other
comment systems using Markdown, which has the benefit of making
migrations to or from HashOver easier.
---
 hashover/backend/classes/markdown.php           | 4 ++--
 hashover/frontend/markdown.js                   | 4 ++--
 hashover/themes/1.0-ported/comments.css         | 4 +---
 hashover/themes/default-borderless/comments.css | 4 +---
 hashover/themes/default/comments.css            | 4 +---
 5 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/hashover/backend/classes/markdown.php b/hashover/backend/classes/markdown.php
index bf278b7b..0c5dd49f 100644
--- a/hashover/backend/classes/markdown.php
+++ b/hashover/backend/classes/markdown.php
@@ -79,13 +79,13 @@ protected function inlineCodeReplace ($grp)
 	// Returns the original inline markdown code with HTML replacement
 	protected function inlineCodeReturn ($grp)
 	{
-		return '' . $this->codeMarkers['inline']['marks'][($grp[1])] . '';
+		return '' . $this->codeMarkers['inline']['marks'][($grp[1])] . '';
 	}
 
 	// Returns the original markdown code block with HTML replacement
 	protected function blockCodeReturn ($grp)
 	{
-		return '' . $this->codeMarkers['block']['marks'][($grp[1])] . '';
+		return '
' . $this->codeMarkers['block']['marks'][($grp[1])] . '
'; } // Parses a string as markdown diff --git a/hashover/frontend/markdown.js b/hashover/frontend/markdown.js index 3d26f4ce..f62ea690 100644 --- a/hashover/frontend/markdown.js +++ b/hashover/frontend/markdown.js @@ -80,7 +80,7 @@ HashOverConstructor.prototype.markdown = { // Return the original markdown code with HTML replacement paragraphs[i] = paragraphs[i].replace (this.inlineCodeMarker, function (marker, number) { - return '' + markdown.codeMarkers.inline.marks[number] + ''; + return '' + markdown.codeMarkers.inline.marks[number] + ''; }); } @@ -89,7 +89,7 @@ HashOverConstructor.prototype.markdown = { // Replace code block markers with original markdown code string = string.replace (this.blockCodeMarker, function (marker, number) { - return '' + markdown.codeMarkers.block.marks[number] + ''; + return '
' + markdown.codeMarkers.block.marks[number] + '
'; }); return string; diff --git a/hashover/themes/1.0-ported/comments.css b/hashover/themes/1.0-ported/comments.css index 4d78eebd..5db4a1fb 100644 --- a/hashover/themes/1.0-ported/comments.css +++ b/hashover/themes/1.0-ported/comments.css @@ -677,7 +677,6 @@ Copyright (C) 2014-2018 Jacob Barkdull #hashover .hashover-comment code { width: 100%; max-height: 200px; - display: inline-block; overflow: auto; border: 1px solid #C1C1C1; background-color: #F5F5F5; @@ -686,8 +685,7 @@ Copyright (C) 2014-2018 Jacob Barkdull margin: 0px; } -#hashover code.hashover-inline { - display: inline; +#hashover code { padding: 1px 4px; border-radius: 0px; font-size: 12px; diff --git a/hashover/themes/default-borderless/comments.css b/hashover/themes/default-borderless/comments.css index 1fecf3be..95dcd5db 100644 --- a/hashover/themes/default-borderless/comments.css +++ b/hashover/themes/default-borderless/comments.css @@ -913,7 +913,6 @@ Copyright (C) 2016-2018 Jacob Barkdull .hashover .hashover-comment pre, .hashover .hashover-comment code { - display: inline-block; width: 100%; max-height: 400px; white-space: pre; @@ -925,8 +924,7 @@ Copyright (C) 2016-2018 Jacob Barkdull overflow: auto; } -.hashover code.hashover-inline { - display: inline; +.hashover code { padding: 1px 4px; } diff --git a/hashover/themes/default/comments.css b/hashover/themes/default/comments.css index 37c30b52..d2e86aa2 100644 --- a/hashover/themes/default/comments.css +++ b/hashover/themes/default/comments.css @@ -873,7 +873,6 @@ Copyright (C) 2016-2018 Jacob Barkdull .hashover .hashover-comment pre, .hashover .hashover-comment code { - display: inline-block; width: 100%; max-height: 400px; white-space: pre; @@ -885,8 +884,7 @@ Copyright (C) 2016-2018 Jacob Barkdull overflow: auto; } -.hashover code.hashover-inline { - display: inline; +.hashover code { padding: 1px 4px; }