diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 19b996e..85445cc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,3 @@ -# .github/workflows/publish.yml name: Publish Python Package on: diff --git a/README.md b/README.md index 3915af8..d076a61 100644 --- a/README.md +++ b/README.md @@ -54,14 +54,26 @@ md2indexhtml path/to/yourfile.md path/to/output/dir --template path/to/template. ### Default Theme +```bash +md2indexhtml README.md output --title "Default Theme" +``` + ![Default](screenshots/index.jpg) ### GoDocs Theme +```bash +md2indexhtml README.md output --title "GoDocs Theme" --template godocs.html +``` + ![GoDocs](screenshots/godocs.jpg) ### DocBox Theme +```bash +md2indexhtml README.md output --title "DocBox Theme" --template docbox.html +``` + ![GoDocs](screenshots/docbox.jpg) # Python API diff --git a/md2indexhtml/__init__.py b/md2indexhtml/__init__.py index de2dfd7..8bcb06b 100644 --- a/md2indexhtml/__init__.py +++ b/md2indexhtml/__init__.py @@ -1,10 +1,7 @@ -# md2indexhtml/__init__.py - -# Correct relative import from .converter import convert_md_to_html # Version of the package -__version__ = "0.1.1" +__version__ = "0.1.2" # Define what is available when the package is imported __all__ = ["convert_md_to_html"] diff --git a/md2indexhtml/converter.py b/md2indexhtml/converter.py index f189b7d..ff3e4b7 100644 --- a/md2indexhtml/converter.py +++ b/md2indexhtml/converter.py @@ -6,6 +6,7 @@ from markdown.extensions.fenced_code import FencedCodeExtension from .utils import load_template, extract_title_and_headers + def convert_md_to_html(md_file_path, output_dir=None, template_path=None, custom_css_path=None, title="Documentation"): """ Convert a Markdown file to an HTML file using a specified template and optional custom CSS. @@ -65,6 +66,7 @@ def convert_md_to_html(md_file_path, output_dir=None, template_path=None, custom print(f"Converted {md_file_path} to {output_path}") + def main(): # Set up argument parsing parser = argparse.ArgumentParser(description='Convert a Markdown file to an HTML file.') @@ -80,5 +82,6 @@ def main(): # Call the conversion function with the parsed arguments convert_md_to_html(args.md_file_path, args.output_dir, args.template, args.css, args.title) + if __name__ == '__main__': main() \ No newline at end of file diff --git a/md2indexhtml/utils.py b/md2indexhtml/utils.py index 732f80a..ccbdf0d 100644 --- a/md2indexhtml/utils.py +++ b/md2indexhtml/utils.py @@ -1,7 +1,6 @@ -# md2indexhtml/utils.py import os import re -import markdown + def load_template(template_name): """ @@ -18,6 +17,7 @@ def load_template(template_name): with open(template_path, 'r', encoding='utf-8') as template_file: return template_file.read() + def extract_title_and_headers(md_content): """ Extract the title (first header) and generate a sidebar from headers and sub-headers in the Markdown content. @@ -44,6 +44,7 @@ def extract_title_and_headers(md_content): return title, headers_html + def slugify(value, separator='-'): """ Convert a string into a slug for use in URLs and IDs. diff --git a/setup.py b/setup.py index 53cf8b8..c0d50fd 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,22 @@ -# setup.py from setuptools import setup, find_packages + +with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + setup( name='md2indexhtml', - version='0.1.1', + version='0.1.2', description='Convert Markdown files to index.html', - author='Your Name', + long_description=long_description, + long_description_content_type='text/markdown', + author='Fasil', author_email='fasilwdr@hotmail.com', url='https://github.com/fasilwdr/md2indexhtml', packages=find_packages(), install_requires=[ 'markdown', ], - readme="README.md", classifiers=[ 'Programming Language :: Python :: 3', 'License :: OSI Approved :: MIT License',