How to use

Use the data-src attribute on empty <pre> elements, like so:

<pre data-src="myfile.js"></pre>

You don’t need to specify the language, it’s automatically determined by the file extension. If, however, the language cannot be determined from the file extension or the file extension is incorrect, you may specify a language as well (with the usual class name way).

Please note that the files are fetched with XMLHttpRequest. This means that if the file is on a different origin, fetching it will fail, unless CORS is enabled on that website.


The plugin’s JS code:


This page:


File that doesn’t exist:


For more examples, browse around the Prism website. Most large code samples are actually files fetched with this plugin.