Skip to main content

Markdown to HTML Converter

This is a converter from Markdown to HTML with advanced support for Markdown tables and GFM syntax highlighting. This package relies on markdown2 for converting basic Markdown to HTML and pygments to support code to HTML conversion for syntax highlighting. The default (and, currently, only) theme for this package is Monokai.

You can find a sample of a site generated from this package at https://mcautograder.chrispyles.io.

Installation

The converter is installed using pip:

pip install md2html

Usage

This package an executable that can be run from the command line:

md2html ...

Here is the help entry for this package:

usage: md2html [-h] [-s SITE] [-n NAV] ...

convert Markdown to HTML

positional arguments:
  files                 files to be converted to HTML

optional arguments:
  -h, --help            show this help message and exit
  -s SITE, --site-info SITE
                        add metadata to the HTML files
  -n NAV, --nav NAV     add a YAML file to use for navigation menu

Running the converter will place HTML files in the same directory as your Markdown files, with the .md extension replaced with .html. The HTML files come with CSS in a style tag in the head.

Page Metadata

If you would like to add metadata to your page, including a navigation menu, do so by creating a YAML file containing this metadata and passing the file path to the -s flag, e.g.

md2html -s meta.yml ...

The structure of your YAML file should be:

title: page title
author: page author
description: page description
navigation:
  nav_title: navigation menu title
  links:
    - title: link name
      url: HTML file path
    - title: ...
      url: ...
    ...

Currently, the title must be set if you use this option. The converter does not yet support navigation submenus, so all links will be rendered as

Navigation Menu

The converter also supports adding only a navigation menu without page metadata. To do this, pass a YAML file to the -n flag. It should have the following structure:

nav_title: navigation menu title
links:
  - title: link name
    url: HTML file path
  - title: ...
    url: ...
  ...

Changelog

v1.3.0:

  • Added unit tests & Travis CI
  • Refactored bin/md2html so that parser code is in md2html/__init__.py

v1.2:

  • Added YAML syntax highlighting

v1.1:

  • Added docstrings for documentation
  • Moved some utils out of md2html/converter.py

v1.0:

  • Changed to Boostrap CSS

v0.1:

  • Initial release

Metadata

Release files for md2html 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md2html 1.3.0
File Size Uploaded Provenance Actions
md2html-1.3.0.tar.gz 8.0 kB Without provenance Details for md2html-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for md2html 1.3.0
File Interpreter ABI Platform Actions
md2html-1.3.0-py3-none-any.whl Python 3 none any Details for md2html-1.3.0-py3-none-any.whl

Total release size: 26.5 kB

Release files / md2html-1.3.0.tar.gz

Download URL md2html-1.3.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f0cf6e6c7fcaddcf10eef13bd3f9d437ee699ca369ed7c52b3c914d9ed6dcb4e
BLAKE2b-256 checksum
How to use checksums
1af1afa5b5e194c2455df6b01bed1276b58112b05f7eb0bf8c0a9896ce9951b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

Release files / md2html-1.3.0-py3-none-any.whl

Download URL md2html-1.3.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65019dada0dcef59f35f68bbf72807c08b35773a037f3a15d5586ac25411803a
BLAKE2b-256 checksum
How to use checksums
406fff37b5530c615cfc2b332dec13128cebe616ef511ca7e4b119f5593ba366
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

Security for md2html 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page