Prism Js highlighting

crabdul
0
crabdul
commented a year ago

Hi,

I am having difficulty using prism js highlighting.
My code block isn't getting parsed at all.

Here is my nuxtent.config file

const Prism = require('prismjs')

module.exports = {
  content: [
    ['articles', {
      page: '/_article',
      permalink: 'articles/:slug',
      generate: ['get', 'getAll']

    }],
    ['projects', {
      page: '/_project',
      permalink: 'projects/:slug',
      generate: ['get', 'getAll']
    }]
  ],
  api: {
    baseURL: ''
  },
  parsers: {
    md: {
      extend (config) {
        config.highlight = (code, lang) => {
          return `<pre class="language-${lang}"><code class="language-${lang}">${Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)}</code></pre>`
        }
      }
    },
    css: [
      './assets/vendor/highlight.css'
    ]
  }
}

My code blocks in my markdown files look like so

 ``` python
 import socket 
 from selectors import DefaultSelector, EVENT_WRITE, EVENT_READ

 selector = DefaultSelector()

```

Any clues as to why it's not working?

0
Informations
Question โ€ข Unresolved
#c121 - Created a year ago