4

I have some json that I want to highlight whenever the textarea field is changed.

Using language-json I don't get any nice coloring, using language-js I do. Isn't json supported?

Tomas Jansson
  • 22,767
  • 13
  • 83
  • 137

1 Answers1

9

You have to import the component as well. I'm not sure if this is "best practice" but it works for me in Angular.

import * as Prism from 'prismjs';
import 'prismjs/components/prism-json'; // need this

Without the second line, JSON syntax isn't highligted at all.

Reed
  • 1,515
  • 1
  • 21
  • 38