0

code-prettify seems to want to grab pretty.css from a cdn, rather than use a local copy - is it possible to configure things so that it uses the local version without a network call?

1 Answer 1

1

The run_prettify.js loads from a CDN and uses query flags to figure out what to load:

<head>
  <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
</head>
<body>
  ...
</body>

The prettify.js script gives you more control over loading but you have to remember to load the language handlers you need and call PR.prettyPrint() on load:

<head>
  <script src="/path/to/prettify.js"></script>
  <link rel="stylesheet" href="/path/to/prettify.css" />
  <!-- You would also need to load the language handlers you need here. -->
</head>
<body onload="PR.prettyPrint()">
  ...
</body>

You can find prettify.{js,css} and the language handlers in https://github.com/google/code-prettify/tree/master/src

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.