html-slack-imajion
v1.1.4
Published
An html to slack conversion utility that supports a wide array of html tags, converting them to slack suitable markdown
Downloads
5
Readme
html-slack
This package converts html to slack markdown with support for more html tags and conforming them to slack standard markdown.
#How to use
const h2s = require("html-slack");
// a header tag
// ============
console.log(h2s("<h1>a header tag"));
// *a strong text*
console.log(h2s("<strong>a strong text</strong>"))
html tags support
The following tags are supported
- All header tags - they are underlined on conversion
- div and p tags
- del, s and strike tags - converted using ~text~ format
- mark and q tags - converted using `text` format
- the i and em tags - converted using _text_ format
- the blockquote and pre tags.
- the ol and ul tags
- u tag
To-do
- conversion of table
Extra
The converter also takes care of element with text-decoration
style attribute.
For example:
// ~this is a deleted text~
console.log(h2s('<span style="text-decoration: line-through">this is a deleted text</span>'));
// `_this is an underlined text_`
console.log(h2s('<span style="text-decoration: underline">this is a underlined text</span>'));