Skip to content

Commit

Permalink
Merge pull request #1 from R5dan/rename
Browse files Browse the repository at this point in the history
Rename to Better-MD
  • Loading branch information
R5dan authored Dec 8, 2024
2 parents 885e104 + 479a556 commit 0d5780a
Show file tree
Hide file tree
Showing 27 changed files with 130 additions and 76 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package to PyPI when a Release is Created

on:
release:
types: [created]

jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/Better-MD
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Todo

- [x] Add basic architecture
- [ ] Add HTML elelemts
- [ ] Publish to Pypi
- [ ] Add innerline support
- [ ] Add escape chars (\\)
- [ ] Add other languages
- [x] Add basic architecture
- [x] Add HTML elelemts
- [x] Publish to Pypi
- [ ] Add innerline support
- [ ] Add escape chars (\\)
- [ ] Add other languages
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from setuptools import setup, find_packages

VERSION = "0.0.1"
DESCRIPTION = "A better markdown library"

setup(
name="Better-MD",
version=VERSION,
author="R5dan",
description=DESCRIPTION,
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
packages=find_packages(),
keywords=['python', 'better markdown', 'markdown'],
classifiers= [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
],
url="https://github.com/Betters-Markdown/better_md"
)
140 changes: 70 additions & 70 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
from better_md import H1, H2, Text, Div, LI, OL, UL, A, Strong, Table, Tr, Td, Th, Blockquote, Em, Input
from Better-MD import H1, H2, Text, Div, LI, OL, UL, A, Strong, Table, Tr, Td, Th, Blockquote, Em, Input

# print(H1(inner=[Text("Hi")]).to_html())
# print(H1(inner=[Text("Hi")]).to_md())
print(H1(inner=[Text("Hi")]).to_html())
print(H1(inner=[Text("Hi")]).to_md())


# print(
# Div(
# inner=[Div(
# inner=[H1(inner=[Text("Hi this is a H1")])]
# ),
# A(inner=[Text("Link")], href="https://www.google.com"),
# Div(
# inner=[
# OL(
# inner=[
# LI(inner=[Text("LI1")]),
# LI(inner=[Text("LI2")]),
# LI(inner=[Text("LI3")])
# ]
# ),
# A(inner=[Text("Link")], href="https://www.google.com")
# ]
# ),
# UL(
# inner=[
# LI(inner=[Text("LI1")]),
# LI(inner=[Text("LI2")]),
# LI(inner=[Text("LI3")])
# ]
# )
# ]
# ).prepare(None).to_md()
# )
print(
Div(
inner=[Div(
inner=[H1(inner=[Text("Hi this is a H1")])]
),
A(inner=[Text("Link")], href="https://www.google.com"),
Div(
inner=[
OL(
inner=[
LI(inner=[Text("LI1")]),
LI(inner=[Text("LI2")]),
LI(inner=[Text("LI3")])
]
),
A(inner=[Text("Link")], href="https://www.google.com")
]
),
UL(
inner=[
LI(inner=[Text("LI1")]),
LI(inner=[Text("LI2")]),
LI(inner=[Text("LI3")])
]
)
]
).prepare(None).to_md()
)

# Bold text
# print(Strong(inner=[Text("Bold text")]).prepare(None).to_md()) # **Bold text**
print(Strong(inner=[Text("Bold text")]).prepare(None).to_md()) # **Bold text**

# # Table example
# print(
# Table(
# inner=[
# Tr(
# inner=[
# Th(inner=[Text("Header 1")]),
# Th(inner=[Text("Header 2")])
# ],
# is_header=True
# ),
# Tr(
# inner=[
# Td(inner=[Text("Cell 1")]),
# Td(inner=[Text("Cell 2")])
# ]
# )
# ]
# ).prepare(None).to_md()
# )
# """
# |Header 1|Header 2|
# |---|---|
# |Cell 1|Cell 2|
# """
# Table example
print(
Table(
inner=[
Tr(
inner=[
Th(inner=[Text("Header 1")]),
Th(inner=[Text("Header 2")])
],
is_header=True
),
Tr(
inner=[
Td(inner=[Text("Cell 1")]),
Td(inner=[Text("Cell 2")])
]
)
]
).prepare(None).to_md()
)
"""
|Header 1|Header 2|
|---|---|
|Cell 1|Cell 2|
"""

# # Blockquote with formatting
# print(
# Blockquote(
# inner=[
# Text("A quote with "),
# Strong(inner=[Text("bold")]),
# Text(" and "),
# Em(inner=[Text("italic")]),
# Text(" text.")
# ]
# ).prepare(None).to_md()
# )
# > A quote with **bold** and *italic* text.
# Blockquote with formatting
print(
Blockquote(
inner=[
Text("A quote with "),
Strong(inner=[Text("bold")]),
Text(" and "),
Em(inner=[Text("italic")]),
Text(" text.")
]
).prepare(None).to_md()
)
> A quote with **bold** and *italic* text.

# Text input
print(Input(type="text", placeholder="Enter your name", required=True).prepare(None).to_html())
Expand Down

0 comments on commit 0d5780a

Please sign in to comment.