Comrak is a Rust-based Markdown parser and renderer that supports the CommonMark specification along with GitHub Flavored Markdown (GFM), making it suitable for converting Markdown content into HTML and other formats. It is useful for documentation, static site generation, and automated content processing. This tutorial demonstrates how to install Comrak on Ubuntu 26.04.
Install Comrak
Determine the latest available Comrak version from the GitHub repository:
COMRAK_VERSION=$(curl -s "https://api.github.com/repos/kivikakk/comrak/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
Download the Comrak binary and place it in the system executable directory:
sudo curl -sSLo /usr/local/bin/comrak https://github.com/kivikakk/comrak/releases/latest/download/comrak-$COMRAK_VERSION-x86_64-unknown-linux-musl
Grant execute permission to the binary:
sudo chmod a+x /usr/local/bin/comrak
Confirm that the installation completed successfully by checking the Comrak version:
comrak --version
Testing Comrak
Create a sample Markdown document:
nano test.md
Add the following content:
# My Project
This is a simple Markdown test document.
## Features
Here is the list of features.
Convert the Markdown file into an HTML document:
comrak test.md -o test.html
The generated HTML content will have a structure similar to the following:
<h1>My Project</h1>
<p>This is a simple Markdown test document.</p>
<h2>Features</h2>
<p>Here is the list of features.</p>
Uninstall Comrak
If the Comrak is no longer needed, delete the executable from the system path:
sudo rm -rf /usr/local/bin/comrak
Remove Comrak configuration directory:
rm -rf ~/.config/comrak
Leave a Comment
Cancel reply