Skip to main content

A simple CLI to convert markdown files to HTML using GitHub API using the GitHub Markdown style.

Project description

ghmd

ghmd (GitHub Markdown) is an extremely light-weight and simple command line tool to convert GitHub Flavored Markdown (or plain Markdown) to HTML.

It does so by using the GitHub Markdown API in combination with GitHub Markdown CSS.

It has two available implementations:

Installation

# Node.js
npm install -g ghmd-js

or

# Python
pip install ghmd

Usage

Simply run ghmd with the path to the markdown file(s) you want to convert. An HTML file will be created in the same directory as the markdown file with the same filename.

ghmd README.md
# or
ghmd README.md CONTRIBUTING.md

[!NOTE] If you don't have the ghmd command available after installing, you may need to add the Python scripts directory to your PATH environment variable.

Otherwise you, can use python -m ghmd instead of ghmd.

Options

GitHub API Token

By default, ghmd uses unauthenticated requests to the GitHub API, which has a rate limit of 60 requests per hour. To increase this limit to 5000 requests per hour, you can set the GITHUB_TOKEN environment variable with a GitHub personal access token:

export GITHUB_TOKEN=your_github_token_here
ghmd README.md

To create a personal access token, visit your GitHub Settings > Developer Settings > Personal access tokens and create a new token (no specific scopes are required).

--embed-css

By default, ghmd will add the remote CSS as a <link> tag in the HTML file. If you want to embed the CSS directly into the HTML file so that, for example, you can send the HTML file to someone else and they can view it without an internet connection, you can use the --embed-css option.

ghmd README.md --embed-css

--light and --dark

The default CSS styles adapt to the system's dark mode setting of the reader. If you want to force the CSS to be light or dark, you can use the --light or --dark options.

ghmd README.md --light
# or
ghmd README.md --dark

Both --light and --dark can be used in combination with --embed-css.

[!NOTE] Using the --embed-css option will result in a ~25 KB larger HTML file size (~18 KB when using --light or --dark).

--no-gfm

The tool offers two modes: GitHub Flavored Markdown (gfm, default) and plain Markdown. To use the latter, the --no-gfm option can be used:

ghmd README.md --no-gfm

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

ghmd-1.0.1.post1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

ghmd-1.0.1.post1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file ghmd-1.0.1.post1.tar.gz.

File metadata

  • Download URL: ghmd-1.0.1.post1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ghmd-1.0.1.post1.tar.gz
Algorithm Hash digest
SHA256 5cb04c94d1f1a09c04c0a5de4d54f33b235ca5b380d74001e0009650f3d6d8be
MD5 2312a4317c61f94e45ba7e03782f6372
BLAKE2b-256 f00e0e067988d2564a37d24f5f84765539283b904aa1c3285f5aac18cbe57146

See more details on using hashes here.

File details

Details for the file ghmd-1.0.1.post1-py3-none-any.whl.

File metadata

  • Download URL: ghmd-1.0.1.post1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ghmd-1.0.1.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 2643563981d5b6fe0055745dc6cdda9b69a391245ed001f0dfaabb0840b6eeac
MD5 c95ac51b740972db350a293c4815e353
BLAKE2b-256 59d453c8ce4d80dd2279d23e6a7eb4a3b3aa1a8ec45a27173cfb6232827126f2

See more details on using hashes here.

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