pub fn PostContent(props: PostContentProps) -> impl IntoViewExpand description
文章内容组件。
Props:
content_html:服务端渲染的文章 HTML 字符串scope_id:可选的局部正文 ID(省略即不传,不要传Some(..));图鉴只增强该实例, 正式页面使用默认范围。
关键行为:
- 把可运行代码块拆成
CodeRunner组件穿插渲染,其余 HTML 片段照旧。 - 在
target_arch = "wasm32"环境下调用window.__initPostContent初始化代码块 复制按钮;P5 §8.2 起正文增强在yggdrasil-enhance.js、灯箱在lightbox.js, 均由本组件按需声明注入(见crate::components::enhance_assets), 这里只经bridges::globals调用;脚本未就绪时调用入队,脚本尾部补执行。
组件函数体只运行一次:同一实例内 content_html 不会更新,上下篇切换须由调用方按
slug 重建本组件(片段解析按内容哈希缓存,重建不重复解析)。
§Required Props
content_html:impl Into<String>
§Optional Props
scope_id: [&'static str]