markdown-this
Extract the readable content of a URL and convert it to Markdown. The package
also handles GitHub repositories and Markdown files through the GitHub API,
arXiv abstract pages through their HTML representation, YouTube videos, and
oEmbed-backed Vimeo/Dailymotion media pages and public X/Twitter posts.
Embedded Arc Fusion article data (including Pagina/12) is extracted by format
from downloaded HTML, local files and browser-supplied HTML alike.
When generic extraction selects too little content, schema.org JSON-LD article
text can be used as a fallback.
Small declarative domain rules can preselect article containers for known
high-value sites such as Substack.
For X/Twitter, public URL extraction uses the shared rich oEmbed renderer;
supplied browser HTML uses declarative post-collection selectors. Neither
path guarantees a complete thread: front matter declares extraction_scope
as oembed or captured-posts, respectively.
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.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| markdown_this-0.1.10.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| markdown_this-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.1 kB
Release files / markdown_this-0.1.10.tar.gz
| Download URL | markdown_this-0.1.10.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bda9d62d1c072076e02ad02f8fd2891aace5a296da0e851a37c0aee3c1ce1c8d
|
|
BLAKE2b-256 checksum How to use checksums |
cf12504f34e10960bbc084935741a020a7504f99f16e520d0a19214246e4505f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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.10-py3-none-any.whl
| Download URL | markdown_this-0.1.10-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
163e56da7609d1c6d90bcd73df5f048345cbeb7fd2c8fb675c2db2c649bc9d28
|
|
BLAKE2b-256 checksum How to use checksums |
784becf0b09324e14b6a0b1f7ac4df302426e79bc82ecafc3ef75c36711aad76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}
|