1

I'm following the basic Heroku tutorial using Python (Django) to stand up a web page. I eventually want to blog, and to include code snippets, so I wanted to include highlight.js to make the code look prettier.

However, I cannot figure out how or where to include the <link ... "style/...css" /> and/or <script ...highlight.min.js" ></script> to get things to render - I end up with plain code-text even though my <pre><code>...</code></pre> tags have hljs class appended, and I can see that the stylesheet and script are linked correctly.

Instead of trying to copy and paste 16 different files with 40 lines each, I think it's easiest to just link to my testing page. page which should be using highlight js but isn't.

Note also that I'm trying to use a highlight.js stylesheet called androidstudio; the giveaway that it's working is that the code background will be gray/black, and some of the words will be bold and different colors (ie the entire point of highlight js).

This question is different from this local static file question because I'm trying to use //cdnjs files, that is, publicly-hosted js and css files.

Community
  • 1
  • 1
dwanderson
  • 2,775
  • 2
  • 25
  • 40
  • I'm partly a dope - I forgot to update my heroku with the `//cdnjs` links, but they are there now; same problem still and I'm using publicly-hosted `js` and `css` files. – dwanderson Feb 14 '16 at 04:18

1 Answers1

1

You forgot the quote (") before stylesheet:

<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/styles/androidstudio.min.css" />

When you view source using Firefox it highlights (no pun intended) your error:

enter image description here

Selcuk
  • 57,004
  • 12
  • 102
  • 110
  • Hmm, that got default highlighting, which is definitely progress; it still doesn't use the `androidstudio` highlighting though (again, telltale sign is dark background). I put the `default.min.js` first – dwanderson Feb 14 '16 at 04:33
  • DOH. So, including your `` helped show me my mistake: instead of `` I was missing the opening `"` before `stylesheet`. It appears to work even without the `default`, for the record. – dwanderson Feb 14 '16 at 04:34
  • 1
    Ahh haha, we both answered the same thing at the same time. Thanks so much, this was driving me insane! – dwanderson Feb 14 '16 at 04:35