From 260d2d7f0e0c692badd40f358d7c900d772bdd6a Mon Sep 17 00:00:00 2001 From: R5dan Date: Sun, 8 Dec 2024 21:11:13 +0000 Subject: [PATCH 1/2] Publish to PYPI --- .github/workflows/publish.yml | 30 ++++++++++++++++++++++++++++++ README.md | 12 ++++++------ setup.py | 24 ++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 setup.py diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d8e35b6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 diff --git a/README.md b/README.md index 9544645..e88e5eb 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ## Todo -- [x] Add basic architecture -- [ ] Add HTML elelemts -- [ ] Publish to Pypi -- [ ] Add innerline support -- [ ] Add escape chars (\\) -- [ ] Add other languages \ No newline at end of file +- [x] Add basic architecture +- [x] Add HTML elelemts +- [x] Publish to Pypi +- [ ] Add innerline support +- [ ] Add escape chars (\\) +- [ ] Add other languages diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..989e1dc --- /dev/null +++ b/setup.py @@ -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" +) \ No newline at end of file From 479a556a44d82ec4c5f5242162f44149fb0ff6a0 Mon Sep 17 00:00:00 2001 From: R5dan Date: Sun, 8 Dec 2024 21:15:49 +0000 Subject: [PATCH 2/2] Reanme to Better-MD --- {better_md => Better-MD}/__init__.py | 0 {better_md => Better-MD}/elements/__init__.py | 0 {better_md => Better-MD}/elements/a.py | 0 .../elements/blockquote.py | 0 {better_md => Better-MD}/elements/br.py | 0 {better_md => Better-MD}/elements/code.py | 0 {better_md => Better-MD}/elements/div.py | 0 {better_md => Better-MD}/elements/h.py | 0 {better_md => Better-MD}/elements/head.py | 0 {better_md => Better-MD}/elements/hr.py | 0 {better_md => Better-MD}/elements/img.py | 0 {better_md => Better-MD}/elements/input.py | 0 {better_md => Better-MD}/elements/li.py | 0 {better_md => Better-MD}/elements/p.py | 0 {better_md => Better-MD}/elements/span.py | 0 {better_md => Better-MD}/elements/symbol.py | 0 {better_md => Better-MD}/elements/table.py | 0 {better_md => Better-MD}/elements/text.py | 0 .../elements/text_formatting.py | 0 {better_md => Better-MD}/html/__init__.py | 0 {better_md => Better-MD}/html/custom_html.py | 0 {better_md => Better-MD}/markdown/__init__.py | 0 .../markdown/custom_markdown.py | 0 tests/test.py | 140 +++++++++--------- 24 files changed, 70 insertions(+), 70 deletions(-) rename {better_md => Better-MD}/__init__.py (100%) rename {better_md => Better-MD}/elements/__init__.py (100%) rename {better_md => Better-MD}/elements/a.py (100%) rename {better_md => Better-MD}/elements/blockquote.py (100%) rename {better_md => Better-MD}/elements/br.py (100%) rename {better_md => Better-MD}/elements/code.py (100%) rename {better_md => Better-MD}/elements/div.py (100%) rename {better_md => Better-MD}/elements/h.py (100%) rename {better_md => Better-MD}/elements/head.py (100%) rename {better_md => Better-MD}/elements/hr.py (100%) rename {better_md => Better-MD}/elements/img.py (100%) rename {better_md => Better-MD}/elements/input.py (100%) rename {better_md => Better-MD}/elements/li.py (100%) rename {better_md => Better-MD}/elements/p.py (100%) rename {better_md => Better-MD}/elements/span.py (100%) rename {better_md => Better-MD}/elements/symbol.py (100%) rename {better_md => Better-MD}/elements/table.py (100%) rename {better_md => Better-MD}/elements/text.py (100%) rename {better_md => Better-MD}/elements/text_formatting.py (100%) rename {better_md => Better-MD}/html/__init__.py (100%) rename {better_md => Better-MD}/html/custom_html.py (100%) rename {better_md => Better-MD}/markdown/__init__.py (100%) rename {better_md => Better-MD}/markdown/custom_markdown.py (100%) diff --git a/better_md/__init__.py b/Better-MD/__init__.py similarity index 100% rename from better_md/__init__.py rename to Better-MD/__init__.py diff --git a/better_md/elements/__init__.py b/Better-MD/elements/__init__.py similarity index 100% rename from better_md/elements/__init__.py rename to Better-MD/elements/__init__.py diff --git a/better_md/elements/a.py b/Better-MD/elements/a.py similarity index 100% rename from better_md/elements/a.py rename to Better-MD/elements/a.py diff --git a/better_md/elements/blockquote.py b/Better-MD/elements/blockquote.py similarity index 100% rename from better_md/elements/blockquote.py rename to Better-MD/elements/blockquote.py diff --git a/better_md/elements/br.py b/Better-MD/elements/br.py similarity index 100% rename from better_md/elements/br.py rename to Better-MD/elements/br.py diff --git a/better_md/elements/code.py b/Better-MD/elements/code.py similarity index 100% rename from better_md/elements/code.py rename to Better-MD/elements/code.py diff --git a/better_md/elements/div.py b/Better-MD/elements/div.py similarity index 100% rename from better_md/elements/div.py rename to Better-MD/elements/div.py diff --git a/better_md/elements/h.py b/Better-MD/elements/h.py similarity index 100% rename from better_md/elements/h.py rename to Better-MD/elements/h.py diff --git a/better_md/elements/head.py b/Better-MD/elements/head.py similarity index 100% rename from better_md/elements/head.py rename to Better-MD/elements/head.py diff --git a/better_md/elements/hr.py b/Better-MD/elements/hr.py similarity index 100% rename from better_md/elements/hr.py rename to Better-MD/elements/hr.py diff --git a/better_md/elements/img.py b/Better-MD/elements/img.py similarity index 100% rename from better_md/elements/img.py rename to Better-MD/elements/img.py diff --git a/better_md/elements/input.py b/Better-MD/elements/input.py similarity index 100% rename from better_md/elements/input.py rename to Better-MD/elements/input.py diff --git a/better_md/elements/li.py b/Better-MD/elements/li.py similarity index 100% rename from better_md/elements/li.py rename to Better-MD/elements/li.py diff --git a/better_md/elements/p.py b/Better-MD/elements/p.py similarity index 100% rename from better_md/elements/p.py rename to Better-MD/elements/p.py diff --git a/better_md/elements/span.py b/Better-MD/elements/span.py similarity index 100% rename from better_md/elements/span.py rename to Better-MD/elements/span.py diff --git a/better_md/elements/symbol.py b/Better-MD/elements/symbol.py similarity index 100% rename from better_md/elements/symbol.py rename to Better-MD/elements/symbol.py diff --git a/better_md/elements/table.py b/Better-MD/elements/table.py similarity index 100% rename from better_md/elements/table.py rename to Better-MD/elements/table.py diff --git a/better_md/elements/text.py b/Better-MD/elements/text.py similarity index 100% rename from better_md/elements/text.py rename to Better-MD/elements/text.py diff --git a/better_md/elements/text_formatting.py b/Better-MD/elements/text_formatting.py similarity index 100% rename from better_md/elements/text_formatting.py rename to Better-MD/elements/text_formatting.py diff --git a/better_md/html/__init__.py b/Better-MD/html/__init__.py similarity index 100% rename from better_md/html/__init__.py rename to Better-MD/html/__init__.py diff --git a/better_md/html/custom_html.py b/Better-MD/html/custom_html.py similarity index 100% rename from better_md/html/custom_html.py rename to Better-MD/html/custom_html.py diff --git a/better_md/markdown/__init__.py b/Better-MD/markdown/__init__.py similarity index 100% rename from better_md/markdown/__init__.py rename to Better-MD/markdown/__init__.py diff --git a/better_md/markdown/custom_markdown.py b/Better-MD/markdown/custom_markdown.py similarity index 100% rename from better_md/markdown/custom_markdown.py rename to Better-MD/markdown/custom_markdown.py diff --git a/tests/test.py b/tests/test.py index 9433126..c7ce4fe 100644 --- a/tests/test.py +++ b/tests/test.py @@ -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())