Crate unidown

Source
Expand description

ยงAbout

Convert Markdown to Unicode:

InputResult
*Emphasis*๐˜Œ๐˜ฎ๐˜ฑ๐˜ฉ๐˜ข๐˜ด๐˜ช๐˜ด
**Strong**๐’๐ญ๐ซ๐จ๐ง๐ 
`Code`๐™ฒ๐š˜๐š๐šŽ
~~Strike~~Sฬถtฬถrฬถiฬถkฬถeฬถ
***Emphasis strong***๐‘ฌ๐’Ž๐’‘๐’‰๐’‚๐’”๐’Š๐’” ๐’”๐’•๐’“๐’๐’๐’ˆ
***Emphasis* strong**๐‘ฌ๐’Ž๐’‘๐’‰๐’‚๐’”๐’Š๐’” ๐ฌ๐ญ๐ซ๐จ๐ง๐ 
***Strong** emphasis*๐‘บ๐’•๐’“๐’๐’๐’ˆ ๐˜ฆ๐˜ฎ๐˜ฑ๐˜ฉ๐˜ข๐˜ด๐˜ช๐˜ด
*`Emphasis code`*โ„ฐ๐“‚๐“…๐’ฝ๐’ถ๐“ˆ๐’พ๐“ˆ ๐’ธโ„ด๐’นโ„ฏ
**`Strong code`**๐“ข๐“ฝ๐“ป๐“ธ๐“ท๐“ฐ ๐“ฌ๐“ธ๐“ญ๐“ฎ
***`Emphasis strong code`***โ’บโ“œโ“Ÿโ“—โ“โ“ขโ“˜โ“ข โ“ขโ“ฃโ“กโ“žโ“โ“– โ“’โ“žโ““โ“”
~~*Strike emphasis*~~๐˜šฬถ๐˜ตฬถ๐˜ณฬถ๐˜ชฬถ๐˜ฌฬถ๐˜ฆฬถ ฬถ๐˜ฆฬถ๐˜ฎฬถ๐˜ฑฬถ๐˜ฉฬถ๐˜ขฬถ๐˜ดฬถ๐˜ชฬถ๐˜ดฬถ
~~**Strike strong**~~๐’ฬถ๐ญฬถ๐ซฬถ๐ขฬถ๐คฬถ๐žฬถ ฬถ๐ฌฬถ๐ญฬถ๐ซฬถ๐จฬถ๐งฬถ๐ ฬถ
~~***Strike emphasis strong***~~๐‘บฬถ๐’•ฬถ๐’“ฬถ๐’Šฬถ๐’Œฬถ๐’†ฬถ ฬถ๐’†ฬถ๐’Žฬถ๐’‘ฬถ๐’‰ฬถ๐’‚ฬถ๐’”ฬถ๐’Šฬถ๐’”ฬถ ฬถ๐’”ฬถ๐’•ฬถ๐’“ฬถ๐’ฬถ๐’ฬถ๐’ˆฬถ
~~`Strike code`~~๐š‚ฬถ๐šฬถ๐š›ฬถ๐š’ฬถ๐š”ฬถ๐šŽฬถ ฬถ๐šŒฬถ๐š˜ฬถ๐šฬถ๐šŽฬถ
~~*`Strike emphasis code`*~~๐”–๐”ฑ๐”ฏ๐”ฆ๐”จ๐”ข ๐”ข๐”ช๐”ญ๐”ฅ๐”ž๐”ฐ๐”ฆ๐”ฐ ๐” ๐”ฌ๐”ก๐”ข
~~**`Strike strong code`**~~๐•พ๐–™๐–—๐–Ž๐–๐–Š ๐–˜๐–™๐–—๐–”๐–“๐–Œ ๐–ˆ๐–”๐–‰๐–Š
~~***`Strike emphasis strong code`***~~๐•Š๐•ฅ๐•ฃ๐•š๐•œ๐•– ๐•–๐•ž๐•ก๐•™๐•’๐•ค๐•š๐•ค ๐•ค๐•ฅ๐•ฃ๐• ๐•Ÿ๐•˜ ๐•”๐• ๐••๐•–

Uses pulldown-cmark and a modified version of its push_html to do real Markdown parsing and rendering. As a result, it normalizes:

  • Headings: Setext headings
  • Unordered lists: *
  • Ordered lists: numbered, .
  • Rules: ---
  • Tables

ยงNotes

  1. This crate does not do syntax highlighting or terminal colors. For that, please check out bat and syntect.

  2. This crate outputs Unicode text using the Mathematical Alphanumeric Symbols and Enclosed Alphanumerics blocks, however your ability to see the effects depends on the specific applications (terminal, text editor, web browser, etc) youโ€™re using and their configurations (fonts, etc).

  3. This crate can be considered an improved version of the markdown2unicode crate but contains no copyrighted nor GPLv3 licensed code from its original upstream source (USBashkaโ€™s markdown2unicode) and uses pulldown-cmark instead.

ยงExample

assert_eq!(
   unidown::convert("\
      Here is some *emphasis*, **strong**, ***strong emphasis***, ~~strike~~, \
      and `code` text.\n\n\
   "),
   "Here is some ๐˜ฆ๐˜ฎ๐˜ฑ๐˜ฉ๐˜ข๐˜ด๐˜ช๐˜ด, ๐ฌ๐ญ๐ซ๐จ๐ง๐ , ๐’”๐’•๐’“๐’๐’๐’ˆ ๐’†๐’Ž๐’‘๐’‰๐’‚๐’”๐’Š๐’”, sฬถtฬถrฬถiฬถkฬถeฬถ, and ๐šŒ๐š˜๐š๐šŽ text.\n\n",
);

Enumsยง

Style

Functionsยง

all
All mode
convert
Convert Markdown to Unicode
demo
Demo mode
push_unicode
Iterate over an Iterator of Events, generate Unicode for each Event, and push it to a String.
write_unicode_fmt
Iterate over an Iterator of Events, generate Unicode for each Event, and write it into Unicode-accepting buffer or stream.
write_unicode_io
Iterate over an Iterator of Events, generate Unicode for each Event, and write it out to an I/O Stream.