문제

Is there any way to insert a link to a file containing source code, instead of pasting the code directly into the webpage to achieve syntax highlighting? (With the "ability to place virtually anything inside the CDATA without having to escape anything . . .")

<pre class="brush: js">

/home/lawlist/archives/init.el

</pre>
도움이 되었습니까?

해결책

@beautifulcoder resolved the issue in a related thread:  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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top