7 releases
0.3.0 | Jul 1, 2024 |
---|---|
0.2.5 | Jul 1, 2024 |
0.2.1 | Jun 25, 2024 |
#1896 in Parser implementations
27 downloads per month
40KB
870 lines
Markterm
Markterm is a rust library to render colored markdown into the terminal. I wanted something like Glow but as a rust library.
Why build this?
I built this for 2 reasons:
- To learn rust
- I couldn't find a crate that did this out of box.
Status
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
Usage
Add it to any existing rust project using cargo. You can then render any markdown to stdout using the code below.
Using Default Theme
use std::path::PathBuf;
fn main() {
let path = PathBuf::from("./test.md");
markterm::render_file_to_stdout(&path, None);
}
Using a custom theme
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));
}
Roadmap
- Add support for all common mark elements
- Make the cli more fully featured.
- Make sure it works in all terminals.
Credits
This project would not be possible without markdown-rs. Their ast parsing module powers the library.
Dependencies
~6–16MB
~228K SLoC