Implementation crate for the code! macro re-exported by dioxus-code under its default macro feature. You usually depend on dioxus-code instead of pulling this in directly.
The macro reads a source file at compile time, parses it with arborium, and expands to a static span tree that can be rendered by dioxus-code.
use code;
let _tree = code!;
Path resolution
Paths are resolved relative to the consumer's CARGO_MANIFEST_DIR. A leading / anchors to that directory; bare paths resolve from it as well. concat!(...) and env!(...) expressions are also accepted.
# use code;
let _tree = code!;
Explicit language
When the file extension isn't enough to infer the language, pass
CodeOptions::builder with CodeOptions::with_language:
use ;
let _tree = code!;
License
MIT.