pub struct MdxBodyEmitter { /* private fields */ }Expand description
Builds an MDX-runtime body - a _createMdxContent(props) function whose
return value is a React tree of jsx, jsxs, and Fragment. Imports +
exports hoist into a prelude; frontmatter is dropped.
Output shape follows @mdx-js/mdx’s function-body format:
Fragment/jsx/jsxsdestructured fromarguments[0]inside the fnconst _components = { tag: "tag", ..., ...props.components }merging default tag strings with consumer overrides; only intrinsics actually referenced get a default entry- capitalized JSX names destructured off
_componentsand pre-validated with_missingMdxReferenceso missing components throw at render time jsxfor zero/one child,jsxsfor multiple
Implementations§
Source§impl MdxBodyEmitter
impl MdxBodyEmitter
pub fn new() -> Self
Sourcepub fn render(doc: &Document) -> (String, DiagnosticEngine<Code>)
pub fn render(doc: &Document) -> (String, DiagnosticEngine<Code>)
Drive the walker; return (body, diag).
Sourcepub fn into_parts(self) -> (String, DiagnosticEngine<Code>)
pub fn into_parts(self) -> (String, DiagnosticEngine<Code>)
Take both buffers: rendered MDX body and per-emitter diagnostics.
pub fn into_string(self) -> String
Trait Implementations§
Source§impl Debug for MdxBodyEmitter
impl Debug for MdxBodyEmitter
Source§impl Default for MdxBodyEmitter
impl Default for MdxBodyEmitter
Auto Trait Implementations§
impl Freeze for MdxBodyEmitter
impl RefUnwindSafe for MdxBodyEmitter
impl Send for MdxBodyEmitter
impl Sync for MdxBodyEmitter
impl Unpin for MdxBodyEmitter
impl UnsafeUnpin for MdxBodyEmitter
impl UnwindSafe for MdxBodyEmitter
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
Mutably borrows from an owned value. Read more