企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 代码高亮 [TOC] ## prismjs 组件使用 [prismjs](http://prismjs.com/index.html#basic-usage) 构建 **使用** ![](https://box.kancloud.cn/7bf8dc005af04e259e5612b2c4103e89_1028x298.png) ``` <pre><code class="language-javascript line-numbers"> window.hdjs = {}; window.hdjs.base = '../'; window.hdjs.uploader = 'php/uploader.php?'; window.hdjs.filesLists = 'php/filesLists.php?'; </code></pre> <script> require(['prism']) </script> ``` **可用语言** 插件基本支持所有开发语言,具体请查看 [https://prismjs.com/#languages-list](https://prismjs.com/#languages-list) 。 使用方式是 `language-xxxx` 比如 `language-css` ## highlight highlight 也是一个代码高亮插件,https://highlightjs.org **使用方法** ``` <div id="markdown"> {!! $article['Markdown'] !!} </div> <script> require(['hdjs', 'marked', 'highlight'], function (hdjs, marked) { $(document).ready(function() { $('pre code').each(function(i, block) { hljs.highlightBlock(block); }); }); }) </script> ```