PrismJS / live

Prism Live: Lightweight, extensible editable code editors. A work in progress, try it out at your own risk (and report bugs!) :)
https://live.prismjs.com
MIT License
105 stars 28 forks source link

Missing documentation for manual setup #30

Open CWBudde opened 2 years ago

CWBudde commented 2 years ago

I want to add the feature of source code highlighting dynamically. Thus, I was looking for information about how to instantiate the plugin by code.

I achieved this with something like:

let textareaControl = document.getElementById("inspector-textarea-control-0"); 
let prismEditor = new Prism.Live(textareaControl);

However, I need to specify the language I want to highlight and don't know the best way to do so. Maybe this could be added to the README, so that I (and others) know how to use it properly

LeaVerou commented 2 years ago

Does a language-xxx class on the textarea not work?