Skip to main content

A better markdown library

Project description

BetterMD

Insallation

pip install better-md

# Extras

pip install better-md[tables] # For pandas support

Usage

HTML

import BetterMD as md

html = md.H1("Hello, world!").to_html()
md = md.H1("Hello, world!")..to_md()
rst = md.H1("Hello, world!").to_rst()

Tables

import BetterMD as md

t = md.Table(
    inner=[
        md.THead(
            inner=[
                md.Tr(
                    inner=[
                        md.Th(inner=[md.Text("Header 1")], styles={"text-align":"left"}),
                        md.Th(inner=[md.Text("Header 2")], styles={"text-align":"center"}),
                        md.Th(inner=[md.Text("Header 3")], styles={"text-align":"right"}),
                        md.Th(inner=[md.Text("Header 4")])
                    ],
                ),
            ]
        ),
        md.TBody(
            inner=[
                md.Tr(
                    inner=[
                        md.Td(inner=[md.Text("Row 1 Cell 1")]),
                        md.Td(inner=[md.Text("Row 1 Cell 2")]),
                        md.Td(inner=[md.Text("Row 1 Cell 3")]),
                        md.Td(inner=[md.Text("Row 1 Cell 4")]),
                    ],
                ),
                md.Tr(
                    inner=[
                        md.Td(inner=[md.Text("Row 2 Cell 1")]),
                        md.Td(inner=[md.Text("Row 2 Cell 2")]),
                        md.Td(inner=[md.Text("Row 2 Cell 3")]),
                        md.Td(inner=[md.Text("Row 2 Cell 4")]),
                    ]
                )
            ]
        )
    ]
)

t.to_md()
t.to_rst()
t.to_html()
t.to_pandas() # Requires `tables` extra

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

better_md-0.3.3.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

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

better_md-0.3.3-py3-none-any.whl (61.6 kB view details)

Uploaded Python 3

File details

Details for the file better_md-0.3.3.tar.gz.

File metadata

  • Download URL: better_md-0.3.3.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for better_md-0.3.3.tar.gz
Algorithm Hash digest
SHA256 62b6669f844503bed5833dbeb8d9b276b7572b69fd1b5ec0d6bd453ae9471be3
MD5 be34c75f1937720c9be3f6249d72385c
BLAKE2b-256 0fc2811605fef159abf2c193996d9959baedde16f6444d808bce52124e9fe41e

See more details on using hashes here.

Provenance

The following attestation bundles were made for better_md-0.3.3.tar.gz:

Publisher: publish.yml on Better-MD/better-md

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

File details

Details for the file better_md-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: better_md-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 61.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for better_md-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 348ce6ce37ed2b1f1b0a0cc19e740de589b4241c446e0f41d7bcfa2ae97da619
MD5 9ddb523d00aa0b30ffd760e8d1b0d737
BLAKE2b-256 6a1fb849882584c9f1ede35e7c62ea8c08072f284e8c1d7fea1f9855032241d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for better_md-0.3.3-py3-none-any.whl:

Publisher: publish.yml on Better-MD/better-md

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

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