Skip to main content

markitdown-office-extension

A markitdown plugin use to customize markdownif. Supports docx, pptx, xlsx, epub, and html file formats.

Usage

from typing import Any, Optional
from io import BytesIO
try:
    from markitdown import MarkItDown
except ImportError:
    from markitdown_no_magika import MarkItDown
from markitdown_office_extension.markdown_converter import MarkdownConverter


class CustomMarkdownConverter(MarkdownConverter):
    def convert_img(
        self,
        el: Any,
        text: str,
        convert_as_inline: Optional[bool] = False,
        **kwargs,
    ) -> str:
        if (src := el.attrs.get("src", None)) is not None:
            # process extracted image such as upload to s3
            # in example, we print image attr only
            print("image alt: {alt}, title: {title}, src: {src}".format(
                alt=el.attrs.get("alt", ""),
                title=el.attrs.get("title", ""),
                src=src,
            ))

            # ... or modify image attr such as `src`
            el.attrs["src"] = "https://example.com/assets/example.png"

            # if not set keep_data_uris, or keep_data_uris is False,
            # markitdown won't display whole image uri
            kwargs["keep_data_uris"] = True

        return super().convert_img(el, text, convert_as_inline, **kwargs)

converter = MarkItDown(enable_plugins=True, markdownify=CustomMarkdownConverter)
document = converter.convert(BytesIO(bytes(
    "![title](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArYAAAOdCAYAAABwHy)",
    encoding="utf-8"
)))

print(document) # ![](https://example.com/assets/example.png)

Metadata

Release files for markitdown-office-extension 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for markitdown-office-extension 0.1.2
File Size Uploaded
markitdown_office_extension-0.1.2.tar.gz 22.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markitdown-office-extension 0.1.2
File Interpreter ABI Platform
markitdown_office_extension-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / markitdown_office_extension-0.1.2.tar.gz

Download URL markitdown_office_extension-0.1.2.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
38cae4da3f075a216b6bdcc4fabee00b866bf987d0b72202e588e75942211986
BLAKE2b-256 checksum
How to use checksums
710e3e901a1f0583e56257baab0852b94c1648aca6d2993702f7ac66d8d9455e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2025.

Transparency log

Release files / markitdown_office_extension-0.1.2-py3-none-any.whl

Download URL markitdown_office_extension-0.1.2-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4959b490e9fd0702dbad60c3bfa0e8f1c7764b6034337e6ada64a23826bba468
BLAKE2b-256 checksum
How to use checksums
a9d8a5baa833f9d3dce8a628ad772620391d17168c0a3ab4f4ba7e9abb4ece0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page