all2md.renderers.ipynb

Renderer for converting AST documents back into Jupyter notebooks.

class all2md.renderers.ipynb.IpynbRenderer

Bases: BaseRenderer

Render an all2md AST document into a Jupyter notebook (ipynb).

Initialize the Jupyter notebook renderer.

Parameters:

options (IpynbRendererOptions or None, optional) – Renderer options for Jupyter notebooks

__init__(options: IpynbRendererOptions | None = None)

Initialize the Jupyter notebook renderer.

Parameters:

options (IpynbRendererOptions or None, optional) – Renderer options for Jupyter notebooks

render(doc: Document, output: str | Path | IO[bytes] | IO[str]) None

Render the AST document to a file path or binary stream.

render_to_string(doc: Document) str

Render the AST document to an in-memory JSON string.

visit_comment(node: Comment) None

Render a Comment node (no-op, handled by markdown renderer).

Parameters:

node (Comment) – Comment to render

Notes

Comments are handled by the MarkdownRenderer which is used to render markdown cell content. This method exists only to satisfy the visitor pattern but is never called during normal rendering flow.

visit_comment_inline(node: CommentInline) None

Render a CommentInline node (no-op, handled by markdown renderer).

Parameters:

node (CommentInline) – Inline comment to render

Notes

Inline comments are handled by the MarkdownRenderer which is used to render markdown cell content. This method exists only to satisfy the visitor pattern but is never called during normal rendering flow.