mdlite 0.2.1

A super-lightweight terminal Markdown reader
Documentation
  • Coverage
  • 20%
    1 out of 5 items documented1 out of 3 items with examples
  • Size
  • Source code size: 27.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.45 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • M-AKIMOTOO/mdlite
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • M-AKIMOTOO

mdlite

mdlite is a super-lightweight terminal Markdown reader written in Rust.

It focuses on the basic features of GitHub Flavored Markdown and keeps the implementation dependency-free.

Installation

cargo install mdlite

Usage

mdlite README.md
cat README.md | mdlite

Library usage

let rendered = mdlite::render_markdown("# Hello\n\n- one\n- two\n", false);
print!("{rendered}");

ANSI styling can be enabled by passing true as the second argument.

let rendered = mdlite::render_markdown("`code` and **bold**\n", true);

To page the rendered output inside a terminal:

let rendered = mdlite::render_markdown("# Document\n", true);
mdlite::run_pager(&rendered)?;
# Ok::<(), String>(())

Supported features

  • ATX headings (#, ##, ...)
  • Setext headings (===, ---)
  • paragraphs
  • fenced code blocks
  • block quotes
  • unordered and ordered lists
  • task list items
  • thematic breaks
  • basic GFM-style tables
  • inline code
  • emphasis and strong emphasis
  • strikethrough
  • links rendered as label <url>

Notes

  • This is intentionally not a full CommonMark/GFM implementation.
  • The feature set is based on the block and inline categories listed in the GFM spec: https://github.github.com/gfm/