# pulldown-cmark-to-flowed  [](https://crates.io/crates/pulldown-cmark-to-flowed) [](https://docs.rs/pulldown-cmark-to-flowed) [](https://codeberg.org/proto-x/pulldown-cmark-to-flowed)
Library to create [`format=flowed`][__link0] plain text from markdown parsed by
[`pulldown-cmark`][__link1].
`format=flowed` is a small extension to plain text that allows for line wrapping to
happen on the client side depending on the screen width of the client. Its main
purpose is for Text E-Mail to provide an improved experience without going through
HTML. At least [Thunderbird][__link2] supports this natively.
## Example
```rust
use pulldown_cmark::Parser;
let md = "Your markdown goes here";
// only the options (and any subset thereof) returned by this function are supported
let opts = pulldown_cmark_to_flowed::parser_options();
let parser = Parser::new_ext(&md, opts);
let mut txt = String::new();
pulldown_cmark_to_flowed::push_text(&mut txt, parser);
```
If your markdown input looked like this:
```markdown
# Example Mail
Here is an example mail to demonstrate `format=flowed` text produced by
[`pulldown-cmark-to-flowed`]. The format has two main advantages:
1. It allows your client to match text to the screen width
2. When quoting text in your response, you avoid the awkward newlines that
get introduced when adding the `>` to the front of the line, but keeping
the line length under the 78 characters recommended in the mail spec.
[`pulldown-cmark-to-flowed`]: https://codeberg.org/proto-x/pulldown-cmark-to-flowed
> Hey, quick question: Could you send me an example mail with `format=flowed`?
```
Then your output looks like this:
```text
Example Mail
============
Here is an example mail to demonstrate format=flowed text produced
by pulldown-cmark-to-flowed [1]. The format has two main
advantages:
1. It allows your client to match text to the screen width
2. When quoting text in your response, you avoid the awkward
newlines that get introduced when adding the > to the front of the
line, but keeping the line length under the 78 characters
recommended in the mail spec.
> Hey, quick question: Could you send me an example mail with
> format=flowed?
--
[1]: https://codeberg.org/proto-x/pulldown-cmark-to-flowed
```
## Work in Progress
This library does not yet support all features of [`pulldown-cmark`][__link3], and there are
some things that could certainly be made configurable (such as the preferred line
width). If you need a feature implemented or think that something could be done
better, please do open an [issue][__link4].
[__cargo_doc2readme_dependencies_info]: ggGmYW0CYXZlMC43LjJhdIQb2o_SNWoR6AAb3_T-k0ODPHwbnQW7uS_D2XsbjVFFtK-lC3BhYvVhcoQbxLvC2fp_mm0bGpZ30iJtfx8b4tdsNH2S7_sbICVCKtskSxZhZIGCbnB1bGxkb3duX2NtYXJrZjAuMTMuMw
[__link0]: https://datatracker.ietf.org/doc/html/rfc3676#section-4
[__link1]: https://crates.io/crates/pulldown_cmark/0.13.3
[__link2]: https://en.wikipedia.org/wiki/Mozilla_Thunderbird
[__link3]: https://crates.io/crates/pulldown_cmark/0.13.3
[__link4]: https://codeberg.org/proto-x/pulldown-cmark-to-flowed/issues