Frage

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>
War es hilfreich?

Lösung

@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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top