@wayfu/waydown
v0.0.7
Published
WayFu WhatsApp Markdown
Downloads
8
Readme

An easy Way For You to Convert WhatsApp Markdown to HTML.
Inspired by Drawdown © Adam Leggett
Install
NPM
npm i --save @wayfu/waydownIn your app.js import and initialized the module like normal.
import Waydown from "@wayfu/waydown";Vanilla
If you wish to skip the modular build and NOT use npm you can use the vanilla build like so:
CDN
<script src="https://unpkg.com/@wayfu/waydown@latest/dist/index.min.js"></script>How to use it:
let text = "This is a sample text to test *Waydown*."
element.innerHTML = Waydown(text)Almost all WhatsApp markdown key supported like *bold*, _italic_, *_bold italic_*, ~strikethrough~, and `code`.
Also support converting link like string to HTML link element.
Options
Waydown accept second parameter for options. It can be a object or boolean. For the object type parameter, we're using elemenOptions from @wayfu/wayfu-dom, you can check there. We just add 1 property plain which accept boolean value.
For the boolean value itself is the plain property value. If this value sets to true, the return is same as the input text. This is usefull if you working at WYISWYG editor for WhatsApp markdown.
type WaydownOption = {
plain: boolean,
} & elemenOptions;
function Waydown(text: string, plain?: boolean): string
function Waydown(text: string, opt?: WaydownOption): stringFor the elementOption as WaydownOption will only be set at the main element. The main element tag will be div by default.
TypeScript
This library comes with TypeScript "typings". If you happen to find any bugs in those, create an issue.
