Skip to main content

Convert Markdown files to index.html for Odoo modules

Project description

md2indexhtml

md2indexhtml is a Python package designed to simplify the creation of index.html files for Odoo modules. It converts Markdown files to HTML with a clean, modern style that integrates well with Odoo's documentation system. The package supports both markdown content and direct HTML sections, allowing for flexible and beautiful documentation.

Features

  • Automatically converts Markdown to styled HTML
  • Creates index.html in the static/description directory (Odoo standard location)
  • Supports direct HTML sections in markdown files
  • Automatic image handling and migration
  • Maintains image directory structure
  • Converts markdown headers (#, ##) into styled sections automatically
  • Creates responsive card-based layouts for content
  • Applies modern, inline styling without external CSS
  • Simple command-line interface
  • Flexible output path options

Installation

Install the package using pip:

pip install md2indexhtml

Usage

Basic Usage

The simplest way to use md2indexhtml is to run it in your Odoo module directory:

cd your_odoo_module
md2indexhtml README.md

This will:

  1. Convert your README.md to HTML
  2. Create a static/description directory if it doesn't exist
  3. Save the converted file as index.html in that directory

Without Arguments

If you run md2indexhtml without any arguments in a directory containing a markdown file:

cd your_odoo_module
md2indexhtml

It will automatically:

  1. Find the first .md file in the current directory
  2. Convert it to HTML
  3. Save it as static/description/index.html

Custom Title

You can specify a custom title for the HTML document (defaults to "Documentation"):

md2indexhtml README.md --title "My Documentation"

Custom Output Path

You can specify a custom output path using the --output or -o argument:

md2indexhtml README.md --output /path/to/output/docs.html
# or use the short form
md2indexhtml README.md -o /path/to/output/docs.html

Mixing HTML and Markdown

You can mix direct HTML sections with markdown content in your files:

<section style="background: #003554;">
    <!-- Your custom HTML section -->
</section>

# Module Title
## Feature 1
- Feature description
- Another point

<section style="background: linear-gradient(...);">
    <!-- Another HTML section -->
</section>

Image Handling

The package automatically handles images in both Markdown and HTML formats:

# Using Markdown syntax
![Alt text](images/screenshot.png)

# Using HTML syntax
<img src="images/screenshot.png" alt="Alt text">

When converting your documentation:

  • Local images are automatically copied to the output directory
  • Original directory structure is maintained
  • Image paths are updated in the generated HTML
  • External images (http/https URLs) remain unchanged
  • Missing images generate warnings but don't stop the conversion

For example, if your markdown file references an image at images/screenshots/feature.png, it will be copied to static/description/images/screenshots/feature.png in the output, maintaining the same directory structure.

The converter will preserve your HTML sections exactly as written while converting markdown sections into styled HTML.

Python API

You can also use the package programmatically in your Python code:

from md2indexhtml import convert_md_to_html

# Convert specific file
convert_md_to_html("README.md")

# Convert with custom output path
convert_md_to_html("README.md", output_path="docs/output.html")

# Convert with custom title
convert_md_to_html("README.md", title="My Documentation")

# Or let it find a markdown file automatically
convert_md_to_html()

Output Style

The converted HTML file includes:

  • Gradient backgrounds for main sections
  • Card-based layout for subsections
  • Modern typography with Inter font
  • Responsive design for all screen sizes
  • Syntax highlighting for code blocks
  • Clean lists and blockquotes styling
  • Mobile-friendly layout
  • All styles are inline (no external CSS needed)

Markdown Conversion

  • # headers become full-width gradient sections
  • ## headers become card sections with white backgrounds
  • Lists, code blocks, and other markdown elements get appropriate styling
  • Custom HTML sections are preserved exactly as written

Sample Usages

  • Sample Usage 1
  • Sample Usage 2
  • Sample Usage 3

Use with Odoo

This package is specifically designed for Odoo module documentation. When you publish your module, the generated index.html in static/description will automatically be used as the module's documentation page on the Odoo Apps store.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub.

License

This project is licensed under the MIT License.

Author

Fasil (@fasilwdr)
Email: fasilwdr@hotmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md2indexhtml-0.1.8.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md2indexhtml-0.1.8-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file md2indexhtml-0.1.8.tar.gz.

File metadata

  • Download URL: md2indexhtml-0.1.8.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for md2indexhtml-0.1.8.tar.gz
Algorithm Hash digest
SHA256 5e32a71124096e9572f881004215f619253c83989b375ec2a4d962b90828e774
MD5 c303438d8f16efef3e684d06c81fc014
BLAKE2b-256 a643faf20f6e40a4a7acae6b70df4b7270a09a3aedfcff1200a1245b29f58e21

See more details on using hashes here.

Provenance

The following attestation bundles were made for md2indexhtml-0.1.8.tar.gz:

Publisher: publish.yml on fasilwdr/md2indexhtml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file md2indexhtml-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: md2indexhtml-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for md2indexhtml-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2e5bba95e7423f376fd9e6d494a49a3264d0e47c97c5cb2a2c7e81e15f632756
MD5 23d9dbb9663dbcf2cf16c82d67e56175
BLAKE2b-256 a5000ba887cfa8a78570c5b0b3103def7e8b8fe5b65bec09f6682f06a3de23f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for md2indexhtml-0.1.8-py3-none-any.whl:

Publisher: publish.yml on fasilwdr/md2indexhtml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page