feat: WASM-based doc viewer (pulldown-cmark)
This commit is contained in:
29
doc_wasm/src/lib.rs
Normal file
29
doc_wasm/src/lib.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn render_markdown(md: &str) -> String {
|
||||
let parser = pulldown_cmark::Parser::new(md);
|
||||
let mut html = String::new();
|
||||
pulldown_cmark::html::push_html(&mut html, parser);
|
||||
// wrap tables
|
||||
html = html.replace("<table>", "<table class=\"table\">");
|
||||
html
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn module_list() -> String {
|
||||
serde_json::to_string(&[
|
||||
("01_auth", "安全認證", "Authentication"),
|
||||
("02_health", "健康檢查", "Health"),
|
||||
("03_register", "檔案註冊", "File Registration"),
|
||||
("04_lookup", "檔案屬性查詢", "File Lookup"),
|
||||
("05_process", "處理流程", "Processing"),
|
||||
("06_search", "搜尋功能", "Search"),
|
||||
("07_identity", "身份識別", "Identity"),
|
||||
("08_identity_agent", "智能身份綁定", "Smart Identity Binding"),
|
||||
("08_media", "串流與截圖", "Streaming & Thumbnails"),
|
||||
("09_tmdb", "TMDb 整合", "TMDb Integration"),
|
||||
("10_pipeline", "生產線", "Pipeline"),
|
||||
("12_agent", "智慧代理", "AI Agents"),
|
||||
]).unwrap_or_default()
|
||||
}
|
||||
Reference in New Issue
Block a user