convert method
convert
Converts the loaded document to Markdown using default options and returns the result with the Markdown content in ConvertResult.content.
def convert(self):
...
Returns: A ConvertResult whose ConvertResult.is_success indicates whether the conversion succeeded. On success, ConvertResult.content contains the Markdown string.
convert
Converts the loaded document to Markdown and writes the output to the specified stream.
The ConvertResult.content property will be None; the Markdown bytes are written directly to output_stream.
def convert(self, output_stream):
...
| Parameter | Type | Description |
|---|---|---|
| output_stream | io.RawIOBase |
A writable stream that will receive the UTF-8 encoded Markdown output. |
Returns: ConvertResult: A ConvertResult indicating success or failure. On success, ConvertResult.content is None because the output was written to the stream.
convert
Converts the loaded document to Markdown and saves the result to a file at the specified output_file_path.
def convert(self, output_file_path):
...
| Parameter | Type | Description |
|---|---|---|
| output_file_path | str |
The path where the Markdown file will be written. |
Returns: ConvertResult: A ConvertResult indicating success or failure. On success, ConvertResult.Content is None because the output was written to the file.
convert
Converts the loaded document to Markdown with the specified options and returns the result with the Markdown content in ConvertResult.content.
def convert(self, convert_options):
...
| Parameter | Type | Description |
|---|---|---|
| convert_options | ConvertOptions |
Options that control the conversion, such as ConvertOptions.heading_level_offset, ConvertOptions.image_export_strategy, and ConvertOptions.page_numbers. Pass None to use defaults. |
Returns: A ConvertResult whose ConvertResult.content contains the Markdown string on success.
convert
Converts the loaded document to Markdown with the specified options, writing the output to a stream.
def convert(self, output_stream, convert_options):
...
| Parameter | Type | Description |
|---|---|---|
| output_stream | io.RawIOBase |
A writable stream that will receive the UTF-8 encoded Markdown output. |
| convert_options | ConvertOptions |
Options that control the conversion. Pass None to use defaults. |
Returns: A ConvertResult indicating success or failure. ConvertResult.content is None because the output was written to the stream.
convert
Converts the loaded document to Markdown with the specified options and saves the result to a file.
def convert(self, output_file_path, convert_options):
...
| Parameter | Type | Description |
|---|---|---|
| output_file_path | str |
The path where the Markdown file will be written. |
| convert_options | ConvertOptions |
Options that control the conversion. Pass None to use defaults. |
Returns: ConvertResult: A ConvertResult indicating success or failure. ConvertResult.content is None because the output was written to the file.
See Also
- class
MarkdownConverter