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.4.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.4-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: better_md-0.3.4.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.4.tar.gz
Algorithm Hash digest
SHA256 77bc8aa1ac6db5e57c3d27b62e520eb7743cc7d7236f24313645fd0a3cd63848
MD5 00750e0c3f50955e8f5ebaa64fd50cb8
BLAKE2b-256 2a48586b92003debb3c5ab35157c90f7c75035fabeeba185d1d50052d080e9c8

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on Better-Python/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.4-py3-none-any.whl.

File metadata

  • Download URL: better_md-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 61.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1e598eb439daab9f72894d4098074f01aede2da1e0cb2ff81d33fcba171b0a4f
MD5 105de28db70d2898eaa816619036c1ae
BLAKE2b-256 71e14a287fadfcc77becf1d187c9087f43c2e76580422e22f03898e766161182

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on Better-Python/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