Author Topic: Prism  (Read 1545 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Prism
« on: June 03, 2020, 05:59:59 pm »
Trying to implement prism (prismjs.com) to highligt json data.

Using in render callback:

Code: [Select]
return '<pre class="language-json"><code class="language-json">' + (JSON.stringify(JSON.parse(ui.cellData), null, 2)) + '</code></pre>' } },
But can't get it work...code is displayed but prism class doesn't seem to be applied...do I need to modify it somehow to make it work with grid?


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Prism
« Reply #1 on: June 03, 2020, 07:47:30 pm »
I presume ui.cellData in your code is json data and not a javascript primitive.

I have no experience of Prismjs.

But looking at its documentation and considering virtual rendering of pqgrid, I guess you may have to use prism programmatically:

Code: [Select]
Prism.highlight( code, Prism.languages.json, 'json');

inside the column.postRender callback of pqgrid.