Expand description
Library to create format=flowed plain text from markdown parsed by
pulldown-cmark.
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 supports this natively.
§Example
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:
# 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:
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, 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.
Constants§
- CONTENT_
TYPE - The
Content-Typevalue forformat=flowedplain text.
Functions§
- parser_
options - The parser options that this library is designed for.
- push_
text - Convert the markdown parser to a nicer text representation that one might expect when reading an email.