A Node.js library (v1.9.1) that converts a subset of HTML to JSON formatted Slack attachments using html-minifier and fast-html-parser. It supports bold, italic, strikethrough, inline and multi-line code, quotes, links, ordered/unordered lists, and basic tables. The HTML must contain a <body> with <section> elements. Slack mrkdwn formatting is applied automatically. Release cadence is low, no major changes in recent history. Differentiator: allows reusing HTML templating for Slack bot messages.
npm install html2slackNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: converts an HTML snippet with a <body> containing a <section> to a Slack attachment JSON object.
Wrap your content in <body><section>...</section></body>.
Use <pre> or <textarea> tags specifically for whitespace-sensitive content.
Update to Node >= 8.0.0 or use an older version of the library.
Use only <td> within tables, avoid <th>.
Use import html2slack from 'html2slack' or const html2slack = require('html2slack')Do not JSON.parse the result; html2slack returns a JavaScript object.
Ensure your HTML has a <body> with <section> inside.