
Product
Socket Threat Intel Now Shows Which Malware Campaigns Were Blocked or Detected
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.
dsh-html-toolkit
Advanced tools
Zero-dependency HTML toolkit for DeepSeek Harness: tolerant HTML parser + DOM tree, html_to_text (main-content extraction), html_to_markdown (reverse conversion with nested lists/tables), clean_html (sanitize scripts, event handlers, unsafe URLs). Uses on
零运行时依赖的 HTML 工具箱,用于 DeepSeek Harness 生态:容错 HTML 解析 + DOM 树,支持正文抽取(HTML→纯文本)、HTML→Markdown 反向转换、HTML 清洗消毒。不依赖任何第三方库,仅用 Node 内置模块。
- / 1. 标记(含嵌套缩进)、表格转竖线行、pre 原样保留、图片取 alt、链接默认只留文字(keep_links=true 附 URL);main_only=true 只取 article/main 主内容;underline_headings=true 标题转下划线风格。language-xxx)、链接(含 title)、图片、嵌套列表(有序支持起始号)、引用、hr、GFM 表格(align / style 对齐保留)、br 硬换行。on* 事件属性、剥离 javascript: / vbscript: / data:text/html 危险 URL、删除注释(可关);标签白名单外的元素解包保留文本;支持 allowed_tags 自定义白名单、keep_style 保留内联样式。# 从 npm 安装
dsh plugin --profile web add dsh-html-toolkit
# 本地开发调试(Debug patch)
# 新建 debug.patch.yml:
# - insert:
# - id: html-toolkit
# name: "E:/dsh-plugins/dsh-html-toolkit/index.js"
dsh web --patch ./debug.patch.yml
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| html | string | 是* | HTML 源文本 |
| from | string | 是* | 从本地 .html/.htm 文件读取 |
| keep_links | boolean | 否 | 链接是否附 URL,默认 false 只留文字 |
| main_only | boolean | 否 | 只取主内容(article/main/#content 启发式),默认 false |
| underline_headings | boolean | 否 | 标题转 文本+下划线 风格,默认 false |
| max_chars | number | 否 | 输出字符数上限(超出截断),默认 20000 |
* html 与 from 二选一。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| html | string | 是* | HTML 源文本 |
| from | string | 是* | 从本地 .html/.htm 文件读取 |
| main_only | boolean | 否 | 只转换主内容,默认 false |
| keep_images | boolean | 否 | 是否保留图片,默认 true |
| max_chars | number | 否 | 输出字符数上限,默认 20000 |
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| html | string | 是* | HTML 源文本 |
| from | string | 是* | 从本地 .html/.htm 文件读取 |
| allowed_tags | string[] | 否 | 允许保留的标签白名单,默认内置约 70 个安全标签 |
| strip_comments | boolean | 否 | 是否删除注释,默认 true |
| keep_style | boolean | 否 | 是否保留 style 属性,默认 false |
| max_chars | number | 否 | 输出字符数上限,默认 20000 |
html_to_text + main_only 提取干净正文,去掉导航、页脚、脚本噪音。html_to_markdown 转回 Markdown 进编辑器或版本库。clean_html 再入库/展示,剥掉脚本与危险链接。from 仅读本地文件;解析全程是纯字符串处理,不执行任何脚本。html_to_text 抽取。| 版本 | 日期 | 说明 |
|---|---|---|
| 0.1.0 | 2026-10-18 | 首个版本:html_to_text / html_to_markdown / clean_html,容错解析 + DOM 树,86 断言测试 |
Q1:这是浏览器的 DOM 吗? 不是。是自研的容错 HTML 解析器(tokenize + 隐式闭合恢复),构建轻量节点树,纯字符串处理,不执行脚本、不加载资源。
Q2:未闭合或错配的标签怎么办?
按浏览器习惯恢复:未闭合标签随父级收尾、li/td/tr 等兄弟隐式闭合、块级标签隐式闭合 <p>、游离闭合标签忽略、错配闭合就地截断,不抛错不丢文本。
Q3:clean_html 默认保留哪些标签?
约 70 个内容型安全标签(p/div/h1-h6/ul/ol/li/table/a/img/pre/code 等);script/style/iframe/form 及交互控件整体移除;白名单外的标签解包保留文字。可用 allowed_tags 完全自定义。
Q4:clean_html 能防住所有 XSS 吗? 它是「降风险」不是「绝对防御」:脚本、事件属性、危险协议 URL 都会剥掉,但输出进浏览器仍建议配合 CSP、服务端校验与编码习惯使用。
Q5:HTML 实体会解码吗? 会。命名实体与十进制/十六进制数字实体都会解码;未知实体原样保留,不会弄丢内容。序列化输出时再统一转义,保证安全。
Q6:main_only 怎么找主内容? 启发式顺序:article/main 标签 → role=main → id 为 content/main → class 含 article/content/post/entry → 兜底 body。找不到就退回全文。
FAQs
Zero-dependency HTML toolkit for DeepSeek Harness: tolerant HTML parser + DOM tree, html_to_text (main-content extraction), html_to_markdown (reverse conversion with nested lists/tables), clean_html (sanitize scripts, event handlers, unsafe URLs). Uses on
The npm package dsh-html-toolkit receives a total of 0 weekly downloads. As such, dsh-html-toolkit popularity was classified as not popular.
We found that dsh-html-toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.

Security News
Fixes for eMudhra and Brotli are out. Getting them everywhere they’re needed means tracking down bundled libraries, runtimes, and certificate stores.

Threat Research
/Security News
Socket uncovered secret-stealing workflows that ran in LiteLLM’s GitHub repository 11 days before the supply chain attack on PyPI and Docker.