Permalink
Browse files

Merge pull request #97 from KuiKui/master

Html encoding fixed in comments + better layout for code display (fix #94)
  • Loading branch information...
KuiKui committed Jun 3, 2012
2 parents 5f9f44c + 05c8ae8 commit d341092a4c9ede6842f2f73b7ab947bc718171d5
Showing with 23 additions and 6 deletions.
  1. +3 −4 lib/helper/MarkdownHelper.php
  2. +9 −1 web/css/less/_comment.less
  3. +11 −1 web/css/main.css
@@ -76,7 +76,8 @@ function Markdown($text) {
$text = preg_replace($pattern, '[$1]($1)', $text);
# Generate line breaks (2 spaces are no more needed)
- $text = preg_replace('/\s*\n/', "\n\r", $text);
+ $text = preg_replace('/\r/', '', $text);
+ $text = preg_replace('/\n/', " \n", $text);
# Transform text using parser.
return $parser->transform($text);
@@ -1125,7 +1126,6 @@ function _doCodeBlocks_callback($matches) {
$codeblock = $matches[1];
$codeblock = $this->outdent($codeblock);
- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
# trim leading newlines and trailing newlines
$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
@@ -1139,7 +1139,7 @@ function makeCodeSpan($code) {
#
# Create a code span markup for $code. Called from handleSpanToken.
#
- $code = htmlspecialchars(trim($code), ENT_NOQUOTES);
+ $code = trim($code);
return $this->hashPart("<code>$code</code>");
}
@@ -2688,7 +2688,6 @@ function doFencedCodeBlocks($text) {
}
function _doFencedCodeBlocks_callback($matches) {
$codeblock = $matches[2];
- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
$codeblock = preg_replace_callback('/^\n+/',
array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
$codeblock = "<pre><code>$codeblock</code></pre>";
View
@@ -94,11 +94,19 @@
list-style-type: decimal;
}
}
+ pre {
+ background-color: @lighterGrey;
+ .radius(5px);
+ color: @darkGrey;
+ font-family: monospace;
+ margin: 8px 5px;
+ padding: 8px;
+ }
code {
background-color: @lighterGrey;
color: @darkGrey;
font-family: monospace;
- padding: 0 3px;
+ padding: 2px 3px;
}
em {
color: @grey;
View
@@ -388,11 +388,21 @@
list-style-position:inside;
list-style-type:decimal;
}
+.comment_bloc .comment .comment_body pre, .comments_holder .comment .comment_body pre {
+ background-color:#eeeeee;
+ border-radius:5px;
+ -webkit-border-radius:5px;
+ -moz-border-radius:5px;
+ color:#333333;
+ font-family:monospace;
+ margin:8px 5px;
+ padding:8px;
+}
.comment_bloc .comment .comment_body code, .comments_holder .comment .comment_body code {
background-color:#eeeeee;
color:#333333;
font-family:monospace;
- padding:0 3px;
+ padding:2px 3px;
}
.comment_bloc .comment .comment_body em, .comments_holder .comment .comment_body em {
color:#666666;

0 comments on commit d341092

Please sign in to comment.