I can include external source markdown into the binary with include_str!()
,
static HOME: &'static str = include_str!("../content/foo.md");
With this my yew application reads
-rw-r--r-- 1 ecarroll ecarroll 111K Jun 14 19:58 ./static/wasm_bg.wasm
Now if I want to display that markdown as HTML, I can use the comrak
module and call markdown_to_html
. This does exactly what I want,
use comrak;
comrak::markdown_to_html(HOME, &comrak::ComrakOptions::default())
Event though HOME
is static str
this results in a 1.3M
assembly (up from 111K`
-rw-r--r-- 1 ecarroll ecarroll 1.3M Jun 14 19:59 ./static/wasm_bg.wasm
Is there anyway in the language to push this calculation into compile-time and exclude all the comrak
stuff from the runtime webassembly?