Model pages and blocks as document nodes

This commit is contained in:
2026-11-30 18:36:16 +08:00
parent 365be3870e
commit 455a3580d6
11 changed files with 481 additions and 35 deletions
+18
View File
@@ -0,0 +1,18 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(tag = "kind", content = "data", rename_all = "snake_case")]
pub enum Inline {
Text(String),
Link { label: String, url: String },
}
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(transparent)]
pub struct RichText(pub Vec<Inline>);
impl From<&str> for RichText {
fn from(value: &str) -> Self {
Self(vec![Inline::Text(value.into())])
}
}