Skip to main content

No project description provided

Project description

Mistune JSON

A JSON renderer for the Mistune Markdown parser.

Supported HTML elements

So far, the HTML elements supported by this renderer are limited to:

  • Paragraph, <p>
  • Image, <img>
  • Ordered lists, <ol>
  • Unordered lists, <ul>
  • All heading elements, <h1> through <h6>
  • Links, <a>
  • Emphasis, <em>
  • Strong, <strong>
  • Blockquote, <blockquote>
  • Line breake, <br>
  • Thematic breake, <hr>
  • Both inline and block code

How to use the JSON renderer

Installation

The package is not yet published in PyPI, but once it is, it will be installed with:

pip install mistune-json

Usage

import mistune
from mistune_json import JsonRenderer

# Create a renderer instance
renderer = JsonRenderer()

# Create a Markdown parser with the JSON renderer
markdown = mistune.create_markdown(renderer=renderer)

# Parse Markdown text
result = markdown("# Hello, world!")

print(result)
# {'content': [{'type': 'h', 'content': ['type': 'text', 'content': 'Hello, world!'], 'level': 1}]}

Improvements and bugs

Tables

There is currently no support for rendering tables (headers and rows). It might be added in the future, if there is enough need for it. You can rise an issue here and label it as enhancement.

Integration testing

Tests for a full Markdown document will be added to assure that the JSON render works as expected.

Bugs

If you find a problem with the JSON output structure, feel free to report a bug.

Project details


Download files

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

Source Distribution

mistune_json-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.

mistune_json-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mistune_json-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Darwin/24.4.0

File hashes

Hashes for mistune_json-0.1.0.tar.gz
Algorithm Hash digest
SHA256 31caf7613ef87e514c56604a30741c2b27536c5b5bf7f03f122f20964118743c
MD5 8e0a25e83694ef8458f60f8f0e37abc2
BLAKE2b-256 ce463ec708eadc47152b85447cb4589201aca50b7e07716ece67b273e4023324

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mistune_json-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Darwin/24.4.0

File hashes

Hashes for mistune_json-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7b4ce09cc12d743a3c3f3e0730a585e17e2f4a45c7d690bd079ea11ed7bb2d0
MD5 a3fa46bd46838f38b562ff63e0aeb64a
BLAKE2b-256 99039997b9e83891c8fd0bd1d3897fd502b08fff843fb648528f5d3a2f66203e

See more details on using hashes here.

Supported by

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