Skip to content

Better-MD/better-md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better-md

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages