Model pages and blocks as document nodes
This commit is contained in:
@@ -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())])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user