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.

Package in Action

Transform your Markdown documentation into beautiful, styled HTML pages for Odoo modules

Clean Documentation Example
Modern Styling Example
Professional Layout Example

Transform your documentation with a single command:

md2indexhtml README.md

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
  • Three template styles: modern, simple, and Odoo-specific
  • Bootstrap-based responsive design
  • 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

Template Styles (New in v0.3.0)

You can now choose between three template styles using the --template or -t argument:

# Modern template with Bootstrap styling
md2indexhtml README.md --template modern

# Simple, clean Bootstrap template
md2indexhtml README.md --template simple

# Odoo-specific template optimized for Odoo Apps Store
md2indexhtml README.md --template odoo

By default, the Odoo template is used if no style is specified.

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](any/path/screenshot.png)

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

When converting your documentation:

  • All local images are automatically copied to an images/ directory in the output path
  • Only the filename is kept, discarding the original directory structure
  • Image paths in the HTML are updated to point to images/filename.png
  • External images (http/https URLs) remain unchanged
  • Base64 encoded images are preserved as is
  • Missing images generate warnings but don't stop the conversion

For example:

  • An image at screenshots/feature.png becomes images/feature.png in the output
  • An image at assets/img/demo/screenshot.png becomes images/screenshot.png
  • An external image https://example.com/image.jpg remains unchanged
  • A base64 image data:image/png;base64,... remains unchanged

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")

# Convert with specific template style (new in v0.3.0)
convert_md_to_html("README.md", template_style="modern")

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

Output Style

The converted HTML file includes:

  • Bootstrap-based responsive design (new in v0.3.0)
  • Modern typography with Inter or Montserrat fonts
  • Responsive design for all screen sizes
  • Syntax highlighting for code blocks
  • Clean lists and blockquotes styling
  • Mobile-friendly layout
  • Three template options to choose from

Template Styles

Modern Template (new in v0.3.0)

  • Contemporary styling with gradients and cards
  • Montserrat font for headings, Inter for body text
  • Hover animations and subtle shadows
  • Perfect for feature-rich modules

Simple Template (new in v0.3.0)

  • Clean, minimalist design
  • Lightweight and fast-loading
  • Focus on readability and content

Odoo Template (new in v0.3.0)

  • Specifically designed for Odoo Apps Store integration
  • Uses Odoo's color scheme and UI patterns
  • Optimized for the marketplace environment

Markdown Conversion

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

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.3.0.tar.gz (15.2 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.3.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for md2indexhtml-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cead15395f073c58ae4d19870271abd11e84c2acf447596afe63f65e22bf2763
MD5 1c10cdab713097fc79510c699b46ad7a
BLAKE2b-256 f437bfb5ade957c36f65c14936b6eefd36f795bfbd4942ca4af72aa2415f792b

See more details on using hashes here.

Provenance

The following attestation bundles were made for md2indexhtml-0.3.0.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.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for md2indexhtml-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5eb4758125f06c2881a7483efce9823ff33cc9ac47dc89f6e01554a28904ebd
MD5 db48a924ad2ec25d92c3e18ad38ac24e
BLAKE2b-256 b1de4002eb557b911e2eef2882a04535a39d6b4538e2ec5c740292bb8d7251e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for md2indexhtml-0.3.0-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