Skip to main content

text2markdown 📝

text2markdown is a Python library for intelligently converting plain text into Markdown.

text2markdown is powered by the Isaacus enrichment API, which converts unstructured documents into rich, highly structured knowledge graphs that can easily be transformed into Markdown.

In all, text2markdown is capable of:

  • Identifying and formatting headings.
  • Segmenting text into nested sections.
  • Hyperlinking cross-references within texts to other sections.
  • Italicizing cited documents.
  • Italicizing defined terms.
  • Detecting and formatting block quotations.
  • Striking through junk text.

Setup 📦

text2markdown can be installed with pip (or uv):

pip install text2markdown

An Isaacus API key is also required to use this library.

Usage 👩‍💻

The code snippet below demonstrates how you might use text2markdown() to intelligently convert a short document into Markdown.

from text2markdown import text2markdown

text = """\
The Smallest Document In The World
This is a generic document.

Section 1 - Background
One upon a time, there was a mayor who said:
We love Markdown so much that everyone should and must use it for everything.

Section 2 - Problem
The mayor's directive, as stated in Section 1, was sadly too difficult to enforce."""

output = text2markdown(text)
print(output)

The output should look something like this:

# The Smallest Document In The World 

This is a generic document. 

## <a id="seg-1"></a>Section 1 - Background 

One upon a time, there was a mayor who said: 

> We love Markdown so much that everyone should and must use it for everything. 

## Section 2 - Problem 

The mayor's directive, as stated in [Section 1](#seg-1), was sadly too difficult to enforce.

An asynchronous version of text2markdown() is also available, supporting all of the same features and arguments as its synchronous equivalent. It can be used like so:

from text2markdown import text2markdown_async

output = await text2markdown_async(text)
print(output)

All of the various capabilities of text2markdown can be toggled on or off using optional Boolean parameters, as shown below:

from text2markdown import text2markdown

from isaacus import Isaacus

output = text2markdown(
    text,
    link_xrefs=True,
    strike_junk=True,
    block_quotes=True,
    escape_lists=True,
    italicize_refs=True,
    italicize_terms=True,
    enrichment_model="kanon-2-enricher",
    isaacus_client=Isaacus(),
)
print(output)

License 📜

This library is licensed under the MIT License.

Metadata

Release files for text2markdown 0.1.5

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

Source distribution (sdist)

Source distribution for text2markdown 0.1.5
File Size Uploaded
text2markdown-0.1.5.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for text2markdown 0.1.5
File Interpreter ABI Platform
text2markdown-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.1 kB

Release files / text2markdown-0.1.5.tar.gz

Download URL text2markdown-0.1.5.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b51fde4dc85aa8505b9ad8bf951b0f58fbf40837d71ef9368c2bf41eeac95c65
BLAKE2b-256 checksum
How to use checksums
44a402fe7e20d4b201cf148b356adc7b22dde9abcf2d6234b7c4544378e42405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 10, 2026.

Transparency log

Release files / text2markdown-0.1.5-py3-none-any.whl

Download URL text2markdown-0.1.5-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
589808606045553f565179ebf5b168b4e46b085a7243bdc79bfa85575890af35
BLAKE2b-256 checksum
How to use checksums
ae7bf4958357ed12592970a024f91171da961d3c1f5c845ddf2c8d78f761f926
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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