Markterm is a rust library to render colored markdown into the terminal. I wanted something like Glow but as a rust library.
I built this for 2 reasons:
- To learn rust
- I couldn't find a crate that did this out of box.
Markterm is currently in development. I will be working over the next few weeks to make sure that it supports CommonMark and Github Flavored Markdown.
MarkTerm currently does not support the following
- Tables
- Inline Html
- Syntax Highlighting for embedded code
Add it to any existing rust project using cargo. You can then render any markdown to stdout using the code below.
use std::path::PathBuf;
fn main() {
let path = PathBuf::from("./test.md");
markterm::render_file_to_stdout(&path, None);
}use std::path::PathBuf;
use markterm::{TextStyle, Theme, ElementStyle};
fn main() {
let path = std::path::PathBuf;
let theme = Theme {
header_1: ElementTheme::new(Some("#000"), Some("#500"), TextStyle::Bold),
.. markterm::get_default_theme()
};
markterm::render_file_to_stdout(&path, Some(&theme));
}- Add support for all common mark elements
- Make the cli more fully featured.
- Make sure it works in all terminals.
This project would not be possible without markdown-rs. Their ast parsing module powers the library.