有没有办法插入包含源代码的文件的链接,而不是直接将代码粘贴到网页中以实现语法高亮? (具有“能够将任何内容放置在CDATA内而无需逃避任何事情......”)
<pre class="brush: js">
/home/lawlist/archives/init.el
</pre>
答案 0 :(得分:0)
@beautifulcoder在相关帖子中解决了这个问题:How to include a file, and wrap its contents in a `pre` tag
<script type="text/javascript">
var ajaxRq = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Msxml2.XMLHTTP");
ajaxRq.open("GET", "/home/lawlist/archives/init.el", false);
ajaxRq.send(null);
document.write('<pre class="brush: lisp">');
document.write(ajaxRq.responseText);
document.write('</pre>');
</script>