Crate dioxus_prism

Crate dioxus_prism 

Source
Expand description

§PrismJS for Dioxus

Render math with PrismJS in Dioxus!

§How to use

  • First you need to import css cdn:
<link rel="stylesheet" href="https://raw.githubusercontent.com/oovm/prism-wasm/dev/projects/prism-wasm/src/prism.min.css">

or use PRISM_CSS to inline css without cdn.

  • Call use_prism_rust hook to prepare context.
  • Call render to get code highlight node.
use dioxus_prism::use_prism_rust;

let rust = use_prism_rust(&cx);
let code = rust.render(text);

Structs§

PrismOptions
Read https://katex.org/docs/options.html for more information.
UsePrism
A hook which keeping the context of KaTeX formula.

Enums§

PrismLanguage
A Rust struct that represents the options for the Prism Wasm library.

Constants§

PRISM_CSS
The needed css which should packing to project

Functions§

prism_render
use_prism
A builder for a UsePrism hook.
use_prism_rust
A builder for a UsePrism hook in display mode.