Skip to content

Commit f829ab4

Browse files
Merge pull request #236 from mashirozx/issue-235
Issue 230 234 235
2 parents 9d5e0a5 + c9a041e commit f829ab4

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

Diff for: functions.php

+1
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,7 @@ function markdown_parser($incoming_comment)
18171817
return $incoming_comment;
18181818
}
18191819
add_filter('preprocess_comment', 'markdown_parser');
1820+
remove_filter( 'comment_text', 'make_clickable', 9 );
18201821

18211822
//保存Markdown评论
18221823
function save_markdown_comment($comment_ID, $comment_approved)

Diff for: inc/Parsedown.php

+23-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Parsedown
1717
{
1818
# ~
1919

20-
const version = '1.7.3';
20+
const version = '1.7.4';
2121

2222
# ~
2323

@@ -1489,22 +1489,41 @@ protected function element(array $Element)
14891489
}
14901490
}
14911491

1492+
$permitRawHtml = false;
1493+
14921494
if (isset($Element['text']))
1495+
{
1496+
$text = $Element['text'];
1497+
}
1498+
// very strongly consider an alternative if you're writing an
1499+
// extension
1500+
elseif (isset($Element['rawHtml']))
1501+
{
1502+
$text = $Element['rawHtml'];
1503+
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
1504+
$permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
1505+
}
1506+
1507+
if (isset($text))
14931508
{
14941509
$markup .= '>';
14951510

1496-
if (!isset($Element['nonNestables']))
1511+
if (!isset($Element['nonNestables']))
14971512
{
14981513
$Element['nonNestables'] = array();
14991514
}
15001515

15011516
if (isset($Element['handler']))
15021517
{
1503-
$markup .= $this->{$Element['handler']}($Element['text'], $Element['nonNestables']);
1518+
$markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
1519+
}
1520+
elseif (!$permitRawHtml)
1521+
{
1522+
$markup .= self::escape($text, true);
15041523
}
15051524
else
15061525
{
1507-
$markup .= self::escape($Element['text'], true);
1526+
$markup .= $text;
15081527
}
15091528

15101529
$markup .= '</'.$Element['name'].'>';

Diff for: inc/classes/Images.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static function cover_gallery() {
154154
$img_array = json_decode($sakura_image_array, true);
155155
$img = array_rand($img_array);
156156
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
157-
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) {
157+
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false) {
158158
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
159159
} else {
160160
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];

Diff for: js/sakura-app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function code_highlight_style() {
146146
}
147147
var ele_name = $('pre:eq(' + i + ')')[0].children[0].className;
148148
var lang = ele_name.substr(0, ele_name.indexOf(" ")).replace('language-', '');
149-
if (lang.toLowerCase() == "hljs") var lang = "text";
149+
if (lang.toLowerCase() == "hljs") var lang = $('pre:eq(' + i + ') code').attr("class").replace('hljs', '')?$('pre:eq(' + i + ') code').attr("class").replace('hljs', ''):"text";
150150
$('pre:eq(' + i + ')').addClass('highlight-wrap');
151151
for (var t in attributes) {
152152
$('pre:eq(' + i + ')').attr(t, attributes[t]);

0 commit comments

Comments
 (0)