From de1dbbd0ac9b7b6e5690ab3d7b2ebfe7d6423802 Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Sat, 12 Mar 2022 17:43:27 -0800 Subject: Add support for quote and equation blocks (#38) --- src/models.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/models.rs') diff --git a/src/models.rs b/src/models.rs index dd886ac..9eab369 100644 --- a/src/models.rs +++ b/src/models.rs @@ -234,6 +234,11 @@ pub struct CodeFields { pub language: String, } +#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] +pub struct Equation { + pub expression: String, +} + #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(tag = "type")] #[serde(rename_all = "snake_case")] @@ -291,6 +296,16 @@ pub enum Block { common: BlockCommon, code: CodeFields, }, + Quote { + #[serde(flatten)] + common: BlockCommon, + quote: TextAndChildren, + }, + Equation { + #[serde(flatten)] + common: BlockCommon, + equation: Equation, + }, #[serde(other)] Unsupported, } @@ -308,7 +323,9 @@ impl AsIdentifier for Block { | ToDo { common, .. } | Toggle { common, .. } | ChildPage { common, .. } - | Code { common, .. } => &common.id, + | Code { common, .. } + | Quote { common, .. } + | Equation { common, .. } => &common.id, Unsupported {} => { panic!("Trying to reference identifier for unsupported block!") } -- cgit v1.2.3