https://github.com/erb3/markdown-builder
Opinionated Rust crate for building markdown documents
https://github.com/erb3/markdown-builder
hacktoberfest markdown markdown-builder rust rust-lang
Last synced: 11 months ago
JSON representation
Opinionated Rust crate for building markdown documents
- Host: GitHub
- URL: https://github.com/erb3/markdown-builder
- Owner: Erb3
- License: mit
- Created: 2024-09-07T16:18:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-02T18:25:34.000Z (11 months ago)
- Last Synced: 2025-04-02T19:29:49.197Z (11 months ago)
- Topics: hacktoberfest, markdown, markdown-builder, rust, rust-lang
- Language: Rust
- Homepage: https://docs.rs/markdown-builder
- Size: 129 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Markdown Builder
**markdown-builder** is an opinionated Rust crate for programmatically building
markdown documents. This project is based of the [markdown-composer] crate by
[mainrs].
```shell
cargo add markdown-builder
```
## Features
- Headers
- Paragraphs
- Word wrapping
- Images
- Footer
- Alt text
- Links
- Footer
- Lists
- Ordered
- Unordered
- Checkboxes
- Transformations
- Italic
- Bold
- Strikethrough
- Codeblocks
- Inline code
- Blockquote
## Usage
> [!NOTE]
> The builders will often panic when you try to do stupid things.
> If you create the structs directly, it will not panic, resulting in potentially invalid markdown.
To fully get the gripe of markdown-builder, a good starting point is the
[documentation](https://docs.rs/markdown-builder/latest/markdown_builder/) or
unit tests. Here however, is a simple example.
```rust
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
[markdown-composer]: https://github.com/mainrs/markdown-composer-rs
[mainrs]: https://github.com/mainrs