In my article about How to setup a Multi Page Application in AngularJS, I wanted to include code from GitHub. Having installed Nzymes on my blog, that wasn’t too difficult.
I thought about using an injection like this:
´{[ =<URL of the file>= | 1.get-url(1) | =javascript= | 1.hl(2) ]}´
so that I could easily reuse it just by changing the URL.
Here are the contents of the execution enzymes.
get-url
The idea is to download the remote file once and store it on the server, in a directory structure like the url (except the protocol). Thus, at any later time, the local copy is returned.
hl
The idea is to wrap the escaped code into a PRE CODE element, prepared for Chili to later highlight it in the browser. Fun fact: above hl highlights itself:
´{[ 1.hl | =php= | 1.hl(2) ]}´.
