Yew Prism
Yew Prism is a highlighter code component based in Prism for yew
How it works
-
Install the
prismjsnode modulenpm install prismjs -
Import the prismjs module and styles, and all the languages component which you want to use for highlighting, in your javascript/typescript main file yew project
import 'prismjs/themes/prism.css';
import 'prismjs/components/prism-markup';
import 'prismjs/components/prism-rust';
import module from '../crate/Cargo.toml';
module.run();
Note: You can use yew-parcel-template or another template described here to create a yew project
- Add yew_prism in your cargo.toml
[]
= { = "0.15", = ["toml", "yaml", "msgpack", "cbor", "web_sys"]}
="0.1"
Note: Currently yew_prism only support web_sys feature. Maybe stdweb feature is included in the future depending if the library continues to be supported.
- Now you are ready to use the component 🚀
Example
use *;
use Prism;
;