Skip to main content

AdfNode

Struct AdfNode 

Source
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: String

The 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

Source

pub fn text(content: &str) -> Self

Creates a text node with the given content.

Source

pub fn text_with_marks(content: &str, marks: Vec<AdfMark>) -> Self

Creates a text node with marks applied.

Source

pub fn paragraph(content: Vec<Self>) -> Self

Creates a paragraph node with the given inline content.

Source

pub fn heading(level: u8, content: Vec<Self>) -> Self

Creates a heading node.

Source

pub fn code_block(language: Option<&str>, text: &str) -> Self

Creates a code block node.

Source

pub fn blockquote(content: Vec<Self>) -> Self

Creates a blockquote node.

Source

pub fn rule() -> Self

Creates a horizontal rule node.

Source

pub fn bullet_list(items: Vec<Self>) -> Self

Creates a bullet list node.

Source

pub fn ordered_list(items: Vec<Self>, start: Option<u32>) -> Self

Creates an ordered list node.

Source

pub fn list_item(content: Vec<Self>) -> Self

Creates a list item node.

Source

pub fn hard_break() -> Self

Creates a hard break node.

Source

pub fn table(rows: Vec<Self>) -> Self

Creates a table node.

Source

pub fn table_with_attrs(rows: Vec<Self>, attrs: Value) -> Self

Creates a table node with attributes (layout, isNumberColumnEnabled).

Source

pub fn table_row(cells: Vec<Self>) -> Self

Creates a table row node.

Source

pub fn table_header(content: Vec<Self>) -> Self

Creates a table header cell node.

Source

pub fn table_header_with_attrs(content: Vec<Self>, attrs: Value) -> Self

Creates a table header cell node with attributes (colspan, rowspan, background, colwidth).

Source

pub fn table_cell(content: Vec<Self>) -> Self

Creates a table cell node.

Source

pub fn table_cell_with_attrs(content: Vec<Self>, attrs: Value) -> Self

Creates a table cell node with attributes (colspan, rowspan, background, colwidth).

Source

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.

Source

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.

Source

pub fn caption(content: Vec<Self>) -> Self

Creates a caption node (used inside tables).

Source

pub fn inline_card(url: &str) -> Self

Creates an inline card node for a smart link (URL as both text and href).

Source

pub fn media_inline(attrs: Value) -> Self

Creates a mediaInline node with the given attributes.

Source

pub fn media_single(url: &str, alt: Option<&str>) -> Self

Creates a media single node wrapping an external image.

Source

pub fn task_list(items: Vec<Self>) -> Self

Creates a task list node.

Source

pub fn task_item(state: &str, content: Vec<Self>) -> Self

Creates a task item node with state "TODO" or "DONE".

Source

pub fn emoji(short_name: &str) -> Self

Creates an emoji node.

Source

pub fn status(text: &str, color: &str) -> Self

Creates a status badge node.

Source

pub fn date(timestamp: &str) -> Self

Creates a date node from an ISO 8601 date string.

Source

pub fn placeholder(text: &str) -> Self

Creates a placeholder node.

Source

pub fn mention(id: &str, display_text: &str) -> Self

Creates a mention node.

Source

pub fn block_card(url: &str) -> Self

Creates a block card node (smart link displayed as a block).

Source

pub fn embed_card( url: &str, layout: Option<&str>, original_height: Option<f64>, width: Option<f64>, ) -> Self

Creates an embed card node.

Source

pub fn panel(panel_type: &str, content: Vec<Self>) -> Self

Creates a panel node.

Source

pub fn expand(title: Option<&str>, content: Vec<Self>) -> Self

Creates an expand (collapsible) node.

Source

pub fn nested_expand(title: Option<&str>, content: Vec<Self>) -> Self

Creates a nested expand node.

Source

pub fn layout_section(columns: Vec<Self>) -> Self

Creates a layout section node.

Source

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.

Source

pub fn decision_list(items: Vec<Self>) -> Self

Creates a decision list node.

Source

pub fn decision_item(state: &str, content: Vec<Self>) -> Self

Creates a decision item node.

Source

pub fn extension( extension_type: &str, extension_key: &str, params: Option<Value>, ) -> Self

Creates a void (block) extension node.

Source

pub fn bodied_extension( extension_type: &str, extension_key: &str, content: Vec<Self>, ) -> Self

Creates a bodied extension node (extension with block content).

Source

pub fn inline_extension( extension_type: &str, extension_key: &str, fallback_text: Option<&str>, ) -> Self

Creates an inline extension node.

Trait Implementations§

Source§

impl Clone for AdfNode

Source§

fn clone(&self) -> AdfNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdfNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AdfNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for AdfNode

Source§

fn eq(&self, other: &AdfNode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AdfNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AdfNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,