Skip to content

Commit

Permalink
Release v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fasilwdr committed Aug 8, 2024
1 parent 3aa4eb0 commit f0b4201
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# .github/workflows/publish.yml
name: Publish Python Package

on:
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions md2indexhtml/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 3 additions & 0 deletions md2indexhtml/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.')
Expand All @@ -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()
5 changes: 3 additions & 2 deletions md2indexhtml/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# md2indexhtml/utils.py
import os
import re
import markdown


def load_template(template_name):
"""
Expand All @@ -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.
Expand All @@ -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.
Expand Down
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[email protected]',
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',
Expand Down

0 comments on commit f0b4201

Please sign in to comment.