Skip to content

Commit

Permalink
更新:优化code短代码渲染
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Feb 18, 2023
1 parent 49d3f1c commit d7e3e71
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Plugins/Topic/src/Lib/ShortCode/ShortCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public function code($match, ShortcodeInterface $shortCode)
{
$lang = $shortCode->getParameter('lang','text');
$content = $shortCode->getContent();
$content = str_replace("<p>", "", $content);
$content = str_replace("</p>", "", $content);
$content = trim($content);
return <<<HTML
<pre class="language-{$lang}"><code>{$content}</code></pre>
HTML;
Expand Down

0 comments on commit d7e3e71

Please sign in to comment.