Functions
parse_notebook
2
tuple[str, dict[str, Any…
▼
Parse a Jupyter notebook (.ipynb) to Markdown content and metadata.
parse_notebook
2
tuple[str, dict[str, Any…
▼
def parse_notebook(content: str, source_path: Path | str | None = None) -> tuple[str, dict[str, Any]]
Parameters
| Name | Type | Description |
|---|---|---|
content |
str |
Raw JSON content of the .ipynb file (caller handles I/O) |
source_path |
Path | str | None |
Optional path for title fallback when notebook has no title Default:None
|
Returns
tuple[str, dict[str, Any]]
_extract_metadata
2
dict[str, Any]
▼
Extract metadata from notebook for frontmatter-like use.
_extract_metadata
2
dict[str, Any]
▼
def _extract_metadata(nb: dict[str, Any], source_path: Path | str | None) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
nb |
dict[str, Any] |
|
source_path |
Path | str | None |
Returns
dict[str, Any]
_cells_to_markdown
1
str
▼
Convert notebook cells to Markdown string.
_cells_to_markdown
1
str
▼
def _cells_to_markdown(nb: dict[str, Any]) -> str
Parameters
| Name | Type | Description |
|---|---|---|
nb |
dict[str, Any] |
Returns
str
_output_to_markdown
1
str
▼
Convert a single output to Markdown/HTML.
_output_to_markdown
1
str
▼
def _output_to_markdown(output: dict[str, Any]) -> str
Parameters
| Name | Type | Description |
|---|---|---|
output |
dict[str, Any] |
Returns
str
_infer_code_language
1
str
▼
Infer language for code cell from metadata.
_infer_code_language
1
str
▼
def _infer_code_language(cell: dict[str, Any]) -> str
Parameters
| Name | Type | Description |
|---|---|---|
cell |
dict[str, Any] |
Returns
str
_escape_html
1
str
▼
Escape HTML special characters.
_escape_html
1
str
▼
def _escape_html(text: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
str