0

My co-founder is currently asking on our blog for an embeddable code widget.

http://devver.net/blog/2008/10/someone-please-build-an-awesome-embeddable-code-widget/

Basically we want something like http://pastie.org/ or http://codepad.org/ but we really want to embed the code section in our blog. We know there are plugins for common blogs and server side solutions, but it would be great to be able to just embed a little javascript and have nicely formatted code anywhere...

Does something like this exist? Have we just missed it?

Ilya
  • 3,104
  • 3
  • 23
  • 30
danmayer
  • 4,326
  • 1
  • 22
  • 15
  • I removed the embedded tag since it's confusing. Under this tag the question related to embedded real-time programming. – Ilya Oct 30 '08 at 21:22

4 Answers4

5

I think you want a javascript syntax highlighter

Sometimes you just keep thinking in the wrong keywords ;-)

Jauco
  • 1,320
  • 13
  • 23
  • Yeah we might end up with syntax highlighter, but we really want it an embeddable widget that is hosted elsewhere. Some people aren't hosting their own blogs and don't deal with managing / hosting / or upgrading the javascript includes required for the google syntax highlighter. – danmayer Oct 30 '08 at 19:30
  • Hmmm, you could paste the javascript inside the html of the template. Otherwise a google pages account is cheap and easy. I don't really expect you need to manage/host it that much. It's just drop it on once and then use it. – Jauco Oct 30 '08 at 20:17
1

We had a user point out a WordPress plugin that uses Gist to do exactly what we were asking for...

http://pomoti.com/gist-it-english

Even if you don't use the plug in it looks like a feature of Gist lets you embed the code anywhere you want on the web. http://gist.github.com

Looks pretty sweet. Thanks goes to Dirceu Jr.

danmayer
  • 4,326
  • 1
  • 22
  • 15
0

Check out CodeRay and UltraViolet. They're both quite good and easy to use.

slothbear
  • 2,016
  • 3
  • 21
  • 38
0

I use a highlighter included in Dojo (adapted from Ivan Sagalaev's highlight.js). All you need to do is to include a few lines of code in the head of your web page (a script tag pointing to AOL or Google, a link to CSS hosted by AOL or Google, and a trivial script to request the highlight) and add <pre><code lang="javascript"> blocks with preformatted snippets — they will be found and highlighted automatically.

Of course, multiple languages are supported as well as automatic guessing the language of your snippet. If user turned off JavaScript, it will degrade gracefully.

Another good point of this solution: no need to host any files, no need to configure servers, no need to generate HTML dynamically, can be used with anything — even static file will be highlighted just fine.

You can see examples in official tests: test_highlight.html, test_pygments.html. This is the example of snippets on my web site: the article with several highlighted code snippets — look in the head of this page to see how the highlighter can be included directly from AOL.

Eugene Lazutkin
  • 43,776
  • 8
  • 49
  • 56