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.2.tar.gz (32.5 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.2-py3-none-any.whl (60.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: better_md-0.3.2.tar.gz
  • Upload date:
  • Size: 32.5 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.2.tar.gz
Algorithm Hash digest
SHA256 62f5fadceecd4715b33f6af80123908d45b15d68474704842920874e42760f8d
MD5 2a26be55ba2bfef332f2a5af02322a73
BLAKE2b-256 6797d9e2a2d9fb15725f04d20dc907d69e543b0959a1e960c6b105e69f26805d

See more details on using hashes here.

Provenance

The following attestation bundles were made for better_md-0.3.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: better_md-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 60.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 751185e729cd85a36582dbb7389926e37285df804b6ebded59f65d17eccaf300
MD5 962de2d7739be181d675394fee463cdc
BLAKE2b-256 fa38d197363a7613adb5bf7492274edacc02bc8cf103c07c8289f764188fe40e

See more details on using hashes here.

Provenance

The following attestation bundles were made for better_md-0.3.2-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