0

I'm using prettify.js for some blog posts. It's handling my html, python, and js fine, but missing the css.

My html is:

<pre>
<code class="prettyprint lang-css">`

    .my-boxclass {
        display: inline-block;
        position: relative;
        cursor: help;
        border-bottom: 1px dotted grey;
    }
</code>
</pre>

and I'm importing prettify. Here's a jsfiddle of exactly what I'm doing (and it's not syntax highlighting the jsfiddle correctly either) https://jsfiddle.net/kfdqLjm1/2/

Martin
  • 22,212
  • 11
  • 70
  • 132
singmotor
  • 3,930
  • 12
  • 45
  • 79

1 Answers1

2

You need to load the CSS language handler. Try adding ?lang=css after run_prettify.js.

Mike Samuel
  • 118,113
  • 30
  • 216
  • 245
  • 1
    That worked! Just out of curiosity, do you know why this is? The prettify doc says that css is automatically included. Also, will this prevent other languages (python, for example) from being automatically recognized? – singmotor Apr 17 '17 at 15:39
  • I think I just got the docs wrong. Which docs did you see this in? – Mike Samuel Apr 17 '17 at 16:30
  • https://github.com/google/code-prettify in the readme, FAQ-> 'for which languages does it work?' css is included in the list – singmotor Apr 17 '17 at 20:51
  • "File extensions supported by default include:" that is missing CSS. Kind of silly but maybe filesize considerations? – Firsh - justifiedgrid.com Aug 06 '18 at 22:21