rheostat2718 / syntaxhighlighter

Automatically exported from code.google.com/p/syntaxhighlighter
GNU General Public License v3.0
0 stars 0 forks source link

[PATCH] Add support for fetching source code from a remote URI. #38

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Nice project.  I've attached a patch to shCore.js that allows you to load 
the source from a remote URI, which I find quite useful.  This would be 
done as follows:

<pre name="code" class="python:remote">enter/link/to/some/code.py</pre>

It's restricted to only fetching URIs from the same server (the default 
behaviour of XMLHttpRequest is to not allow open() on a different site).  

Needs a bit more work before it's production ready; the error messages 
need improving and it'd be nice to spruce up the aesthetics while it's 
loading the file.  (I don't know JavaScript so there may be better ways to 
implement what I've done as well.  I've kept the style consistent to yours 
though.)

Examples of it in the real world:
http://blogs.onresolve.com/?p=6
http://blogs.onresolve.com/?p=8

Full file is here: http://dark.teleri.net/~tnelson/shCore.js
Patch against trunk: http://dark.teleri.net/~tnelson/shCore.js.patch

Thoughts?

    Trent.

Original issue reported on code.google.com by trent.p....@gmail.com on 15 Oct 2007 at 1:05

Attachments:

GoogleCodeExporter commented 8 years ago
One disadvantage I see of this is that it doesn't degrade at all.  It just 
becomes
the URL in text.

Maybe something like:
<a href="enter/link/to/some/code.py" class="python:remote">View the Source</a>

Ciao!

Original comment by docw...@gmail.com on 19 Oct 2007 at 8:09