draft-js-prism icon indicating copy to clipboard operation
draft-js-prism copied to clipboard

Different language highlighting examples

Open yasuf opened this issue 8 years ago • 3 comments

Can you point me on the right direction as to how to select a different language other than JS when highlighting using this decorator?

I can try putting something together so that this repo could have an example on the README on how to do that.

yasuf avatar Apr 16 '18 04:04 yasuf

I have the same question! Thanks again:)

sebalvarez07 avatar May 20 '19 21:05 sebalvarez07

Yeah same, I would like for it to auto detect which language!

byluz avatar Feb 25 '20 22:02 byluz

Here is how you are able to do that:


      {
        type: "code-block",
        text: 'var message = "This is awesome!";',
        data: {
          syntax: "javascript",
        },
      },
      {
        type: "code-block",
        text: "<h1>I am superman</h1>",
        data: {
          syntax: "html",
        },
      },

so, you just need to figure out how blocks are working and add a block with syntax you need

pleerock avatar Mar 04 '20 15:03 pleerock