summaryrefslogtreecommitdiffstats
path: root/libs/Contents.php
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2020-04-09 00:19:11 +0800
committerBigCoke233 <hi@guhub.cn>2020-04-09 00:19:11 +0800
commitf5bced134e73cf20da42124f77ab001a38f1739b (patch)
treed8c1284de31305b2cacb9eeda3fdf1ebbbb3b921 /libs/Contents.php
parentaad116339e17c1d9d048e37e5a7b824b3ccc4f30 (diff)
:notebook_with_decorative_cover: Add: 拓展 Markdown 语法,支持 kbd 标签
Diffstat (limited to 'libs/Contents.php')
-rw-r--r--libs/Contents.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/Contents.php b/libs/Contents.php
index 06e7246..da552a5 100644
--- a/libs/Contents.php
+++ b/libs/Contents.php
@@ -14,7 +14,7 @@ class Contents
$text = empty($last) ? $data : $last;
if ($widget instanceof Widget_Archive) {
//ParseOther
- $text = Contents::parseEmo(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip(Contents::parseLink($text))))))));
+ $text = Contents::parseEmo(Contents::parseKbd(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip(Contents::parseLink($text)))))))));
//LazyLoad
$text = preg_replace('/<img (.*?)src(.*?)(\/)?>/','<img $1src="/usr/themes/Miracles/images/loading/'.$load_image.'.gif" data-original$2 />',$text);
}
@@ -183,6 +183,14 @@ class Contents
$text = preg_replace('/<pre><code>/s','<pre><code class="language-html">',$text);
return $text;
}
+
+ /**
+ * 解析键盘按键
+ */
+ static public function parseKbd($text) {
+ $text = preg_replace('/\~(.*?)\~/s','<kbd>${1}</kbd>',$text);
+ return $text;
+ }
/**
* 解析章节链接