Reference for JupyterNotebookParser
The JupyterNotebookParser
enables parsing of jupyter notebooks (.ipynb files).
Bases: AbstractParser
Class used to parse jupyter notebooks (.ipynb).
__init__(include_code_cells_outputs=False)
Initializes the class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include_code_cells_outputs
|
bool)
|
Whether or not the cells' output should be parsed as well. If False, they will be ignored. Default to False. |
False
|
parse_file(filepath)
Chunks a notebook .ipynb file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
str
|
the path to the file to parse. |
required |
Returns:
Name | Type | Description |
---|---|---|
MarkDownDoc |
MarkdownDoc
|
the parsed markdown object. |
parse_string(string)
Parses the string considering it is a notebook content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
the string representing the notebook content. Assumed to be a dumped version of the JSON formatted notebook. |
required |
Returns:
Name | Type | Description |
---|---|---|
MarkdownDoc |
MarkdownDoc
|
the formatted markdown document. |
read_file(filepath)
staticmethod
Reads a .ipynb file and returns its content as a json dict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
str
|
path to the file |
required |
Returns:
Type | Description |
---|---|
JupyterNotebookContent
|
dict[str, Any]: the json content of the ipynb file |