Skip to main content

md-to-telegraph

PyPI

Convert Markdown text into Telegraph DOM nodes.

Overview

md-to-telegraph transforms a Markdown string into a list of Telegraph-compatible DOM node dicts, suitable for use with the Telegraph API.

Telegraph nodes follow this structure:

{
  "tag": "p",
  "attrs": {"href": "..."},
  "children": ["text", {"tag": "strong", "children": ["bold"]}]
}

Installation

uv add md-to-telegraph

Usage

from md_to_telegraph import md_to_telegraph

nodes = md_to_telegraph("# Hello\n\nThis is **bold** text.")
# [
#   {"tag": "h3", "children": ["Hello"]},
#   {"tag": "p", "children": ["This is ", {"tag": "strong", "children": ["bold"]}, " text."]}
# ]

Markdown features supported

Markdown element Telegraph output
# Heading 1 <h3>
## Heading 2 <h4>
### Heading 3+ <p><strong>…</strong></p>
**bold** <strong>
*italic* <em>
`code` <code>
~~strike~~ <del>
[text](url) <a href="…">
<url> <a href="…">
![alt](url) <img src="…">
```lang\ncode\n``` <pre><code>
> quote <blockquote>
- item / 1. item <ul> / <ol>
--- <hr>
hard line break ( ) <br>
soft line break space

Development

uv run pytest

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md_to_telegraph-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md_to_telegraph-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file md_to_telegraph-0.1.0.tar.gz.

File metadata

  • Download URL: md_to_telegraph-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","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}

File hashes

Hashes for md_to_telegraph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9617e8bf2ef94ae7ebc7e85127e5f9b39f19623e826f5edf16ee6b3e372fbe41
MD5 b61fa7dab19a0a71440f7096be0e1253
BLAKE2b-256 16dc71e1510a4a0b0ba785e52ffbebe41d511c08813a8807f5744463d20726b1

See more details on using hashes here.

File details

Details for the file md_to_telegraph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: md_to_telegraph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","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}

File hashes

Hashes for md_to_telegraph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1dab95e8e51b70844525653109d690ca2d1a3feeb551c4370d992779c14f6801
MD5 0881feb2d3cb30a64c366e59d0e1ee77
BLAKE2b-256 6324b256128730c50fd059295f480877814e87e814aaf3b65fc22f39fccadd8d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.8

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 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