pub struct AdfNode {
pub node_type: String,
pub attrs: Option<Value>,
pub content: Option<Vec<Self>>,
pub text: Option<String>,
pub marks: Option<Vec<AdfMark>>,
pub local_id: Option<String>,
pub parameters: Option<Value>,
}Expand description
A node in the ADF tree.
Represents both block nodes (paragraph, heading, codeBlock, etc.) and inline nodes (text, hardBreak, mention, etc.).
Fields§
§node_type: StringThe node type identifier (e.g., “paragraph”, “text”, “heading”).
attrs: Option<Value>Node-specific attributes (e.g., heading level, code language).
content: Option<Vec<Self>>Child content nodes.
text: Option<String>Text content (only present on text nodes).
marks: Option<Vec<AdfMark>>Inline marks applied to this node (bold, italic, link, etc.).
local_id: Option<String>Top-level local ID (used by expand, nestedExpand, and other node types).
parameters: Option<Value>Top-level parameters (used by expand nodes with macroMetadata, etc.).
Implementations§
Source§impl AdfNode
impl AdfNode
Sourcepub fn text_with_marks(content: &str, marks: Vec<AdfMark>) -> Self
pub fn text_with_marks(content: &str, marks: Vec<AdfMark>) -> Self
Creates a text node with marks applied.
Sourcepub fn paragraph(content: Vec<Self>) -> Self
pub fn paragraph(content: Vec<Self>) -> Self
Creates a paragraph node with the given inline content.
Sourcepub fn code_block(language: Option<&str>, text: &str) -> Self
pub fn code_block(language: Option<&str>, text: &str) -> Self
Creates a code block node.
Sourcepub fn blockquote(content: Vec<Self>) -> Self
pub fn blockquote(content: Vec<Self>) -> Self
Creates a blockquote node.
Sourcepub fn bullet_list(items: Vec<Self>) -> Self
pub fn bullet_list(items: Vec<Self>) -> Self
Creates a bullet list node.
Sourcepub fn ordered_list(items: Vec<Self>, start: Option<u32>) -> Self
pub fn ordered_list(items: Vec<Self>, start: Option<u32>) -> Self
Creates an ordered list node.
Sourcepub fn hard_break() -> Self
pub fn hard_break() -> Self
Creates a hard break node.
Sourcepub fn table_with_attrs(rows: Vec<Self>, attrs: Value) -> Self
pub fn table_with_attrs(rows: Vec<Self>, attrs: Value) -> Self
Creates a table node with attributes (layout, isNumberColumnEnabled).
Sourcepub fn table_header(content: Vec<Self>) -> Self
pub fn table_header(content: Vec<Self>) -> Self
Creates a table header cell node.
Sourcepub fn table_header_with_attrs(content: Vec<Self>, attrs: Value) -> Self
pub fn table_header_with_attrs(content: Vec<Self>, attrs: Value) -> Self
Creates a table header cell node with attributes (colspan, rowspan, background, colwidth).
Sourcepub fn table_cell(content: Vec<Self>) -> Self
pub fn table_cell(content: Vec<Self>) -> Self
Creates a table cell node.
Sourcepub fn table_cell_with_attrs(content: Vec<Self>, attrs: Value) -> Self
pub fn table_cell_with_attrs(content: Vec<Self>, attrs: Value) -> Self
Creates a table cell node with attributes (colspan, rowspan, background, colwidth).
Sourcepub fn table_header_with_attrs_and_marks(
content: Vec<Self>,
attrs: Option<Value>,
marks: Vec<AdfMark>,
) -> Self
pub fn table_header_with_attrs_and_marks( content: Vec<Self>, attrs: Option<Value>, marks: Vec<AdfMark>, ) -> Self
Creates a table header cell node with attributes and marks.
Sourcepub fn table_cell_with_attrs_and_marks(
content: Vec<Self>,
attrs: Option<Value>,
marks: Vec<AdfMark>,
) -> Self
pub fn table_cell_with_attrs_and_marks( content: Vec<Self>, attrs: Option<Value>, marks: Vec<AdfMark>, ) -> Self
Creates a table cell node with attributes and marks.
Sourcepub fn inline_card(url: &str) -> Self
pub fn inline_card(url: &str) -> Self
Creates an inline card node for a smart link (URL as both text and href).
Sourcepub fn media_inline(attrs: Value) -> Self
pub fn media_inline(attrs: Value) -> Self
Creates a mediaInline node with the given attributes.
Sourcepub fn media_single(url: &str, alt: Option<&str>) -> Self
pub fn media_single(url: &str, alt: Option<&str>) -> Self
Creates a media single node wrapping an external image.
Sourcepub fn task_item(state: &str, content: Vec<Self>) -> Self
pub fn task_item(state: &str, content: Vec<Self>) -> Self
Creates a task item node with state "TODO" or "DONE".
Sourcepub fn placeholder(text: &str) -> Self
pub fn placeholder(text: &str) -> Self
Creates a placeholder node.
Sourcepub fn block_card(url: &str) -> Self
pub fn block_card(url: &str) -> Self
Creates a block card node (smart link displayed as a block).
Sourcepub fn embed_card(
url: &str,
layout: Option<&str>,
original_height: Option<f64>,
width: Option<f64>,
) -> Self
pub fn embed_card( url: &str, layout: Option<&str>, original_height: Option<f64>, width: Option<f64>, ) -> Self
Creates an embed card node.
Sourcepub fn expand(title: Option<&str>, content: Vec<Self>) -> Self
pub fn expand(title: Option<&str>, content: Vec<Self>) -> Self
Creates an expand (collapsible) node.
Sourcepub fn nested_expand(title: Option<&str>, content: Vec<Self>) -> Self
pub fn nested_expand(title: Option<&str>, content: Vec<Self>) -> Self
Creates a nested expand node.
Sourcepub fn layout_section(columns: Vec<Self>) -> Self
pub fn layout_section(columns: Vec<Self>) -> Self
Creates a layout section node.
Sourcepub fn layout_column<V: Into<Value>>(width: V, content: Vec<Self>) -> Self
pub fn layout_column<V: Into<Value>>(width: V, content: Vec<Self>) -> Self
Creates a layout column node.
width accepts any value convertible into a JSON number (integer or
float). The original numeric type is preserved on the width attribute
so that round-tripping doesn’t coerce integer widths to floats.
Sourcepub fn decision_list(items: Vec<Self>) -> Self
pub fn decision_list(items: Vec<Self>) -> Self
Creates a decision list node.
Sourcepub fn decision_item(state: &str, content: Vec<Self>) -> Self
pub fn decision_item(state: &str, content: Vec<Self>) -> Self
Creates a decision item node.
Sourcepub fn extension(
extension_type: &str,
extension_key: &str,
params: Option<Value>,
) -> Self
pub fn extension( extension_type: &str, extension_key: &str, params: Option<Value>, ) -> Self
Creates a void (block) extension node.
Sourcepub fn bodied_extension(
extension_type: &str,
extension_key: &str,
content: Vec<Self>,
) -> Self
pub fn bodied_extension( extension_type: &str, extension_key: &str, content: Vec<Self>, ) -> Self
Creates a bodied extension node (extension with block content).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AdfNode
impl<'de> Deserialize<'de> for AdfNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for AdfNode
Auto Trait Implementations§
impl Freeze for AdfNode
impl RefUnwindSafe for AdfNode
impl Send for AdfNode
impl Sync for AdfNode
impl Unpin for AdfNode
impl UnsafeUnpin for AdfNode
impl UnwindSafe for AdfNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more