Skip to main content

Linked Markdown Python

Python implementation of Linked Markdown, packaged for PyPI.

Status: All 26 conformance tests passing.

API

from linked_markdown.extract import extract
from linked_markdown.errors import (
    LinkedMarkdownError,
    LMD_NO_FRONTMATTER,
    LMD_INVALID_FRONTMATTER,
)

result = extract(markdown)
# => ExtractResult(front_matter="...", body="...", attrs={...})

extract(content: str) -> ExtractResult[dict]

Parses frontmatter from a Linked Markdown document. Supports YAML (---, ---yaml, = yaml =), JSON (---, ---json, = json =), and TOML (---toml, +++, = toml =) formats.

  • Strips UTF-8 BOM and normalizes CRLF to LF before parsing.
  • Returns front_matter with a trailing newline for non-empty frontmatter.
  • front_matter is "" for empty frontmatter (---\n---).
  • body has leading newlines stripped.

LinkedMarkdownError

Thrown for all error conditions. Has a .code property:

Code When
LMD_NO_FRONTMATTER No frontmatter delimiters found
LMD_INVALID_FRONTMATTER Unknown marker, unparseable content, non-object attrs, or no closing delimiter
try:
    extract(markdown)
except LinkedMarkdownError as e:
    if e.code == LMD_NO_FRONTMATTER:
        ...

Development

git submodule update --init --recursive
uv sync
uv run pytest

Download files

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

Source Distribution

linked_markdown-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

linked_markdown-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: linked_markdown-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for linked_markdown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 53d866230794c0be468fb287fcad9f606c01fd6f881249f80f8da14aeff56f97
MD5 e2fd71eeda3440fbf8ae2ef39bd932bd
BLAKE2b-256 18f0551b8c0642d17ba9921442d47161d4936a1614cc6be8372241e717404089

See more details on using hashes here.

Provenance

The following attestation bundles were made for linked_markdown-0.1.0.tar.gz:

Publisher: release.yml on wazootech/linked-markdown-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for linked_markdown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0c7464038ffa61b92dbbf4e1e27bced18c39cd68e05611ed6dfa57b9cbebeb8
MD5 cbba56c9ecc062237f7999730c529c72
BLAKE2b-256 7a72d98295f3b056916aa0b7e4cae474e3945835fa6cc87c164fffcbf24f5f9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for linked_markdown-0.1.0-py3-none-any.whl:

Publisher: release.yml on wazootech/linked-markdown-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page