2016-06-12 17 views
0

Ich versuche mit Prettyprint die Benutzeroberfläche meines Codes zu formatieren, aber ich bekomme keine Formatierung.Einfaches Prettyprint-Programm funktioniert nicht

HTML:

<html> 
<head> 
<link href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css" rel="stylesheet"> 
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> 
</head> 
<body onload="prettyPrint()"> 
<pre class="prettyprint"> 
    &lt;div&gt; This is a div &lt;/div&gt; 
    &lt;a href="http://www.google.com"&gt;Bollywood &lt;/a &gt; 
</pre> 
</body> 
</html> 

Referenzen:

  1. https://github.com/google/code-prettify
  2. https://github.com/google/code-prettify/blob/master/docs/getting_started.md
  3. https://rawgit.com/google/code-prettify/master/styles/index.html

Kann mir bitte jemand helfen?

I want the default layout in the 3rd link provided. 

Antwort

1

Try this:

<html> 
<head> 
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css"> 
    <style type="text/css"></style><link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/google/code-prettify/master/loader/prettify.css"> 
</head> 
<body> 

    <pre class="prettyprint linenums"> 
    &lt;div&gt; This is a div &lt;/div&gt; 
    &lt;a href="http://www.google.com"&gt;Bollywood &lt;/a &gt; 
    </pre> 

</body> 
</html> 

Eine Online-Demo here zur Verfügung steht. Das gewünschte Thema muss als CSS-Datei enthalten sein (z. B. this css file).

Verwandte Themen