atk14 / highlight-source-code
模板中代码高亮的助手
dev-master
2024-06-28 11:04 UTC
Requires
- php: >=5.3.0
- easybook/geshi: 1.0.8.*
Requires (Dev)
- atk14/tester: 0.3.*
This package is auto-updated.
Last update: 2024-08-28 11:30:47 UTC
README
模板中代码高亮的助手。
它使用 GeSHi,基本由一个块函数和Smarty模板引擎的修饰符组成。
在 ATK14 模板中的使用
{!$html_snippet|highlight_source_code}
{!$php_snippet|highlight_source_code:"php"}
{!$template_snippet|highlight_source_code:"smarty"}
还有一个块助手,提供了更多选项
{highlight_source_code}
<h1>Title</h1>
{/highlight_source_code}
{highlight_source_code lang="html" overal_class="code code--html" overal_id="id_content"}
<h1>Title</h1>
{/highlight_source_code}
安装
只需使用 Composer
cd path/to/your/atk14/project/
composer require atk14/highlight-source-code dev-master
可选地,你可以将助手链接(或复制并编辑)到你的项目中。
ln -s ../../vendor/atk14/highlight-source-code/src/app/helpers/block.highlight_source_code.php app/helpers/
ln -s ../../vendor/atk14/highlight-source-code/src/app/helpers/modifier.highlight_source_code.php app/helpers/
许可证
HighlightSourceCode 是免费软件,根据 MIT 许可证条款分发 许可