mthc is a Markdown-to-HTML converter written in C.
Version 1.0.2
mthc currently supports the Markdown Basic Syntax as defined in the Markdown Guide, plus one Extended Syntax feature: automatic heading IDs. Additional extensions are planned for future releases.
It ships with a built-in stylesheet based on the Catppuccin color palette and supports light/dark mode. Code blocks are highlighted with highlight.js. The CSS/JS required for styling and highlighting are embedded directly in the generated HTML. If you prefer a bare document, you can disable styling to produce plain HTML.
Note: Custom stylesheets are not yet supported. As a workaround, disable the built-in styles and add your own CSS manually.
Prebuilt packages are available for Debian/Ubuntu, RHEL/CentOS/Rocky/Alma, and Arch Linux (x86_64/amd64). Download them from the GitHub Releases page.
You can also build from source with make (see below).
Download the .deb that matches your OS release, then install:
sudo apt install ./mthc-{version}-{release}.{distro}_{arch}.deb
Download the .rpm that matches your OS release, then install:
sudo dnf install ./mthc-{version}-{release}.{distro}.{arch}.rpm
Download the .pkg.tar.zst package, then install:
sudo pacman -U ./arch-mthc-{version}-{release}-{arch}.pkg.tar.zst
git clone --depth 1 --branch vX.Y.Z https://github.com/liuminhaw/mthc.git
gcc (C compiler)
libunistring-dev
libpcre2-dev
make
Your system must have libunistring and libpcre2-8 installed for mthc to run. If install from a package, these dependencies will be handled automatically.
Using mthc is simple. Just provide a Markdown file and mthc writes HTML to standard output. Use --output to write to a file.
mthc [options] <markdown_file>
Options:
--help Show this help message
--output=FILE Specify output html file (default: stdout)
--no-style Disable CSS styling in the output HTML
--debug Enable debug logging
--test For testing purposes only
--version Show version information
The --debug flag writes verbose diagnostic output to standard error and is primarily intended for development.
Currently supported markdown syntax includes:
When using raw HTML in Markdown, the HTML block must be followed by a blank lineāeven after the closing tag. The parser treats everything from the opening tag up to the next blank line as part of the HTML block.
See the Basic Syntax reference here.
mthcautomatically generatesidattributes for headings based on their text. Custom IDs are not supported yet.
If you have questions about using mthc, feel free to email [email protected]. To report bugs or request features, please open an issue in the GitHub repository. Pull requests are welcome.