GitHub MarkDown Converter: ghmd.py — ghmdlib - v0.1.0 Documentation

# GitHub MarkDown Converter: ghmd.py

App:

  ghmd(lib)

Purpose:

  This library and command line tool are designed to convert Markdown files into GitHub-style HTML format.

  This module provides both the project's command line interface and back-end library.

Platform:

  Linux/Windows | Python 3.10+

Developer:

  J Berendt

Email:

  development@s3dev.uk

Comments:

  This project is a fork of the ghmd project and has been updated to include an installable library to interface with your other Python applications. Additionally, the command line interface has been updated to include additional features.

class Converter

  Bases: `object`

  Primary Markdown to HTML document conversion class.

  Example:

    Convert a Markdown file to GitHub-style HTML:

        >>> from ghmdlib import converter

        >>> converter.convert(path='/path/to/file.md', preview=True)

    Convert a Markdown file to GitHub-style HTML, in offline mode:

        >>> from ghmdlib import converter

        >>> converter.convert(path='/path/to/file.md', offline=True)

  convert(path: str | list[str], *, theme: str = 'dark', embed_css: bool = False, no_gfm: bool = False, offline: bool = False, preview: bool = False) → bool

    Convert the given path(s) from Markdown to GitHub-style HTML.

    Note

    Once converted, the HTML file is created in the same directory as the source file, with the same filename and an '.html' file extension.

    Parameters:

      - path (str | list[str]) -- Full path to the Markdown file (or list of files) to be converted.

      - theme (str, optional) -- Theme to be used for the HTML. Options: 'dark', 'light'. Defaults to 'dark'.

      - embed_css (bool, optional) -- Embed the CSS in the HTML file rather than linking. Defaults to False.

      - no_gfm (bool, optional) -- Disable GitHub Flavoured Markdown (GFM) and use the standard format. Defaults to False.

      - offline (bool, optional) -- Keep offline. Use cached CSS and local conversion libraries rather than the GitHub API.

      - preview (bool, optional) -- Open each converted HTML file in a web browser to view the results. Defaults to False.

    Returns:

      True if the conversion is successful, otherwise False.

    Return type:

      bool