#markdown #documentation #builder #markdown-text #code-block

markdown-builder

Opinionated Rust crate for programmatically building markdown documents

1 stable release

1.0.0 Sep 15, 2024

#121 in Template engine

Download history 138/week @ 2024-09-12 27/week @ 2024-09-19 9/week @ 2024-09-26 2/week @ 2024-10-03

176 downloads per month

MIT license

37KB
965 lines

markdown-builder

Opinionated Rust crate for programmatically building markdown documents.

This project is based of the markdown-composer crate by mainrs.

Features

  • Headers
  • Paragraphs
    • Word wrapping
  • Images
    • Footer
    • Alt text
  • Links
    • Footer
  • Lists
    • Ordered
    • Unordered
    • Checkmarks
  • Transformations
    • Italic
    • Bold
    • Strikethrough
    • Codeblocks
    • Inline code
    • Blockquote

Example

To fully get the gripe of markdown-builder, a good starting point is the unit tests. Here however, is a simple example.

let mut doc = Markdown::new();

doc.image(
  ImageBuilder::new()
    .url("https://example.com/picture.png")
    .text("A cute picture of a sandcat")
    .footer()
    .build(),
);

doc.paragraph("Hello World");

println!("output: {}", doc.render())

Why fork?

This project was forked out of markdown-composer due to a multitude of reasons:

  • Fun
  • Markdown-composer looked unmaintained
  • Not wanting the additional settings to make it work for everyone
  • Word wrapping

Dependencies

~1.5MB
~36K SLoC