Skip to main content

markdown-this

PyPI

Extract readable content from a URL, local file, or supplied HTML and convert it to Markdown.

Features

  • GitHub repositories and Markdown files through the GitHub API.
  • arXiv abstract pages, YouTube videos, and oEmbed-backed Vimeo, Dailymotion, and public X/Twitter posts.
  • Embedded Arc Fusion article data, including Pagina/12.
  • Local files and browser-supplied HTML.
  • schema.org JSON-LD article text as a fallback when generic extraction is too short.
  • Declarative container rules for selected sites, including Substack.

Public X/Twitter URLs use oEmbed; browser-supplied HTML uses post-collection selectors. Neither mode guarantees a complete thread. The resulting front matter identifies the extraction scope as oembed or captured-posts.

Installation

uv add markdown-this

Usage

from markdown_this import extract_main_content

title, markdown, fallback_text, intro = extract_main_content(
    "https://example.com/article"
)

The source can also be a local HTML file (Path or path string) or raw HTML:

from pathlib import Path
from markdown_this import extract_main_content

title, markdown, fallback_text, intro = extract_main_content(Path("article.html"))
title, markdown, fallback_text, intro = extract_main_content(
    "<html><p>...</p></html>", source_url="https://example.com/article"
)

extract_main_content returns the title, extracted Markdown, plain-text fallback, and a short introduction suitable for a notification or preview. The Markdown value starts with YAML front matter containing the metadata that was found, such as title, author, url, date, and the declared page type (article, website, home, and so on).

For example:

---
title: An article
author: An author
url: https://example.com/article
date: 2026-08-06
---

Article content.

The package also installs a markdown-this command:

uvx markdown-this https://example.com/article
uvx markdown-this article.html
cat article.html | uvx markdown-this -
uvx markdown-this thread.html --source-url https://x.com/alice/status/1002

The command writes the extracted Markdown to stdout. Its input may be a URL, an existing HTML path, or HTML read from stdin.

The lower-level fetchers and normalization helpers are available from the package modules when an application needs more control over the pipeline.

Development

uv run pytest packages/markdown-this/tests
uv run ruff check packages/markdown-this

License

MIT

Metadata

Release files for markdown-this 0.1.15

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

Source distribution (sdist)

Source distribution for markdown-this 0.1.15
File Size Uploaded
markdown_this-0.1.15.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markdown-this 0.1.15
File Interpreter ABI Platform
markdown_this-0.1.15-py3-none-any.whl Python 3 none any Details

Total release size: 35.0 kB

Release files / markdown_this-0.1.15.tar.gz

Download URL markdown_this-0.1.15.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4fd2f32068118d9a626d991dcd92a2d92bb829acc8d57f490d23cf15ea3d88bc
BLAKE2b-256 checksum
How to use checksums
f86eb5cd2c88f8b87b4b224fa72a8d55534aeda21840b7e07e33c0f294da0ff2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / markdown_this-0.1.15-py3-none-any.whl

Download URL markdown_this-0.1.15-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0d3ef0601e1e42de9211c6326fdf7fe4810bfed1610ef00acdabf6e6a547c56
BLAKE2b-256 checksum
How to use checksums
bd51c003a029501f738cf1f03ccd8e568eef3966532beeff5e1c1fe917e2c632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.15 This release

2 release files

0.1.10

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

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