diff options
| author | BigCoke233 <hi@guhub.cn> | 2020-04-15 18:03:06 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2020-04-15 18:03:06 +0800 |
| commit | b07e8e34b35671ef2bde0712d03385c6b197c692 (patch) | |
| tree | 3946604147c8ce38fdb18bbfd2567e1f3c6f3ae4 /libs/Contents.php | |
| parent | 02af96794734b2ed8431eeefe5a4fc8e56c67224 (diff) | |
:bell: Fix: 修复带有特殊字符的标题锚点失效
Diffstat (limited to 'libs/Contents.php')
| -rw-r--r-- | libs/Contents.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/Contents.php b/libs/Contents.php index 256ff46..ead2293 100644 --- a/libs/Contents.php +++ b/libs/Contents.php @@ -230,9 +230,9 @@ class Contents { // 增加单独标记,否则冲突 $id = $matchs[3]; - $id = str_replace(' ','\%20',$id); - $id = str_replace('&','\%26',$id); - $id = str_replace('?','\%3F;',$id); + $id = str_replace(' ','_',$id); + $id = str_replace('&','_',$id); + $id = str_replace('?','_',$id); return '<h'.$matchs[1].$matchs[2].' id="'.$id.'">'.$matchs[3].'<a href="#'.$id.'" title="章节链接" class="post-toc-link no-line"><i class="iconfont icon-paragraph"></i></a></h'.$matchs[1].'>'; } |
