Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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)

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

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>

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top