socketry-markdown 0.1.1

CommonMark compliant markdown parser in Rust with ASTs and extensions
Documentation
// Released under the MIT License.
// Copyright, 2024, by Bnchi.
// Copyright, 2024, by Titus Wormer.
// Copyright, 2026, by Samuel Williams.

//! JS equivalent: https://github.com/syntax-tree/mdast-util-to-markdown/blob/main/lib/handle/paragraph.js
use super::Handle;
use crate::markdown::{
    construct_name::ConstructName,
    state::{Info, State},
};
use crate::{
    mdast::{Node, Paragraph},
    message::Message,
};

impl Handle for Paragraph {
    fn handle(
        &self,
        state: &mut State,
        info: &Info,
        _parent: Option<&Node>,
        node: &Node,
    ) -> Result<alloc::string::String, Message> {
        state.enter(ConstructName::Paragraph);
        state.enter(ConstructName::Phrasing);
        let value = state.container_phrasing(node, info)?;
        state.exit();
        state.exit();
        Ok(value)
    }
}