Implement MVP Typst embedding
Dependencies
- [2]
A4E5KLI2Turn arguments into sidebar - [3]
C73UJ7ZYCreate simple `xilem_html` demo - [*]
REI53XR4Render argument state as HTML - [*]
JFJVY57RList `clap` argument IDs - [*]
G4Q265KP - [*]
BMG4FSHNAdd basic `clap` support
Change contents
- edit in src/main.rs at line 79
}fn content(state: &AppState) -> impl View<AppState> + ViewMarker {el::div(include_str!("../dist/.stage/docs/test.html")) - replacement in src/main.rs at line 95
el::div(()).attr("id", "content"),el::div(content(&state)).attr("id", "content"), - file addition: docs[7.1]
- file addition: test.typ[0.207]
= HelloHello from typst! - file addition: build.rs[7.1]
use std::{ffi::OsStr, path::PathBuf, process::Command};use walkdir::WalkDir;const TRUNK_STAGING_DIRECTORY: &str = "dist/.stage";const DOCS_SOURCE: &str = "docs";// TODO: avoid re-building docs every timefn main() {// Recursively find all .typ (typst) files within `docs/`let typst_files = WalkDir::new(DOCS_SOURCE).into_iter()// Remove inaccessible directories.filter_map(|possible_entry| possible_entry.ok())// Only find files.filter(|entry| entry.path().is_file())// Only find typst (.typ) files.filter(|entry| entry.path().extension() == Some(OsStr::new("typ")));// Set up the staging directorystd::fs::create_dir_all(TRUNK_STAGING_DIRECTORY).unwrap();// Build all the fileslet prefix = PathBuf::from(DOCS_SOURCE);let staging_dir = PathBuf::from(TRUNK_STAGING_DIRECTORY).join(DOCS_SOURCE);for file in typst_files {let parent = file.path().parent().unwrap();// Handle nested directories correctlylet remainder = if parent != prefix {assert!(parent.starts_with(&prefix));parent.strip_prefix(&prefix).unwrap().to_path_buf()} else {PathBuf::new()};// Create the appropriate directory layoutlet mut output_path = staging_dir.join(remainder).join(file.path().file_name().unwrap());// Our input is .typ, but output is .htmloutput_path.set_extension("html");std::fs::create_dir_all(output_path.parent().unwrap()).unwrap();Command::new("pandoc").args([file.path().to_str().unwrap(),"-o",output_path.to_str().unwrap(),]).status().expect("Error running pandoc. Check if it's installed");}} - edit in Cargo.toml at line 15[3.1474]
[build-dependencies]walkdir = "2.4.0" - edit in Cargo.lock at line 209
"walkdir", - edit in Cargo.lock at line 252
name = "same-file"version = "1.0.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"dependencies = ["winapi-util",][[package]] - edit in Cargo.lock at line 391[8.3866][8.3866]
[[package]]name = "walkdir"version = "2.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"dependencies = ["same-file","winapi-util",] - edit in Cargo.lock at line 467[3.7968][8.3880]
name = "winapi"version = "0.3.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"dependencies = ["winapi-i686-pc-windows-gnu","winapi-x86_64-pc-windows-gnu",][[package]]name = "winapi-i686-pc-windows-gnu"version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"[[package]]name = "winapi-util"version = "0.1.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"dependencies = ["winapi",][[package]]name = "winapi-x86_64-pc-windows-gnu"version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"[[package]]