ahsteele
ahsteele

Reputation: 26494

Is there a Content Delivery Network (CDN) that hosts Google Code Prettify?

Is there a content delivery network (CDN) that is hosting google-code-prettify?

I am putting together a blog on TypePad and would like to take advantage of a CDN if possible.

Upvotes: 61

Views: 9709

Answers (5)

m.spyratos
m.spyratos

Reputation: 4219

There is a CDN for prettify:

https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js

Its use is explained on the official code-prettify repository. You can use it with a skin, like this:

<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?skin=desert"></script>

That way you don't have to worry about additional CSS files. For more details and a full list of URL configurations, check the Getting Started section.


As mentioned by Jan Šotola, the previous RawGit CDN was shut down.
Read more details on migrating away from deprecated RawGit.

Upvotes: 4

Bernhard Heijstek
Bernhard Heijstek

Reputation: 2141

You could create an account on Dropbox and put all the JavaScript and CSS files in the public folder. This worked for me!

Upvotes: -2

Rajish
Rajish

Reputation: 6805

Found it!

http://www.cdnjs.com/libraries/prettify

<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.js" type="text/javascript"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.css" type="text/css">

Update: https://github.com/cdnjs/cdnjs/issues/695 (see bottom of page)

Upvotes: 34

Peter Dietz
Peter Dietz

Reputation: 2679

You can use Google Code Prettify directly.

Read their Google Code Prettify Readme or wiki, and they tell you how to use them as the hosting provider.

<script
 src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"
 type="text/javascript"></script>

Then to use the prettyprint powers of Google Code Prettify, add class="prettyprint" to your code blocks, which should be in a pre or a code. Examples below:

<pre class="prettyprint">...</pre>

or

<code class="prettyprint">...</code>

Upvotes: 4

tXK
tXK

Reputation: 712

I believe you could use it directly from Google Code though.. ? embeding
http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js

Upvotes: 4

Related Questions