Skip to content

Sitelink-Spatial/html-slack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. All header tags - they are underlined on conversion
  2. div and p tags
  3. del, s and strike tags - converted using text format
  4. mark and q tags - converted using `text` format
  5. the i and em tags - converted using _text_ format
  6. the blockquote and pre tags.
  7. the ol and ul tags
  8. 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>'));

About

An html to slack conversion utility that supports a wide array of html tags, converting them to slack suitable markdown

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%