0

code-prettify 似乎想从 cdn 中获取 pretty.css,而不是使用本地副本 - 是否可以配置东西以便它使用本地版本而无需网络调用?

4

1 回答 1

1

run_prettify.jsCDN 加载并使用查询标志来确定要加载的内容:

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

prettify.js脚本使您可以更好地控制加载,但您必须记住加载所需的语言处理程序并PR.prettyPrint()在加载时调用:

<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>

您可以在https://github.com/google/code-prettify/tree/master/srcprettify.{js,css}中找到语言处理程序

于 2018-04-02T13:11:23.643 回答