Official ObjectGraph Blog
Saturday, January 13, 2007
Pygments.com Launched
I purchased Pygments.com domain yesterday. Iam surprised the domain is still available. i guess the Pygments guys dont really care about the .com domain name.
Any way access it via http://www.pygments.com
You can use the code colorizer by going to the Colorizer Test Program.
But the cool thing i added is, a javascript service to colorize any code. Lets say you have a webpage with code, that needs colorizing, Just add this Javascript to the end of the page (Before you close the body tag)
<script src="http://www.pygments.com/js/init.js" type="text/javascript"></script>
All you will need to do is define your code in <pre> tags with unique ids that include some information about the type of the language.
For example:
<pre id="python_1">
print "Hello World"
</pre>
It will automatically colorize the page by making JSON type requests to pygments.com with the code in the page.
So the above would come out like this
print "Hello World"
BTW: pygments javascript is enabled on this site
Labels: json, pygments.com, python
posted by gavi at 5:59 PM
5 Comments:
Excellent!!
By Anonymous, at 8:46 AM
Rather cool. Would you consider doing some minor tweaks, and have its underlying JSON(P) a stable end point for direct use, too?
Re: the minor tweaking, it would be useful if it allowed a callback= query parameter (substituting the leading "setPigment"), and an option of skipping your leading and trailing div/pre tag encapsulation.
Additional features that wouldn't hurt: treating a lack of the query parameters id=, css= and linenos=, as the empty value.
By Johan Sundström, at 10:15 AM
Those are good suggestions. I will see if i can do them this weekend.
By gavi, at 1:20 PM
Hi I try to use this tool for python but I have found that > and < (or > or <) are displayed wrong in my source code (as the html versions > and < which renders my source code not that readable). Would be nice if you could change that. Thanks DR0ID
By Anonymous, at 3:01 PM
Can you send us the example page you are using?
By gavi, at 10:32 PM
Post a Comment
<< Home