@adobe/helix-importer

中文文档
3.4.158发布于 2026/10/19Apache-2.0ES Module构建来源已验证近 30 天下载 2724

Helix Importer tool: create md / docx from html

原始使用文档
文档目录5 节
  1. Importer
  2. HTML2x helpers
  3. Importer UI
  4. Installation
  5. Usage

Helix Importer

Foundation tools for importing website content into that can be consumed in an Helix project.

Basic concept of the importer: for an input url, transform the DOM and convert it into a Markdown / docx file.

Importer

An importer must extends PageImporter and implement the fetch and process method. The general idea is that fetch receives the url to import and is responsible to return the HTML. process receives the corresponding Document in order to filter / rearrange / reshuffle the DOM before it gets processed by the Markdown transformer. process computes and defines the list of PageImporterResource (could be more than one), each resource being transformed as a Markdown document.

Goal of the importer is to get rid of the generic DOM elements like the header / footer, the nav... and all elements that are common to all pages in order to get the unique piece(s) of content per page.

HTML2x helpers

HTML2x methods (HTML2md and HTML2docx) are convienence methods to run an import. As input, they take:

  • URL: URL of the page to import
  • document: the DOM element to import - a Document object or a string (see createDocumentFromString for the string case)
  • transformerCfg: object with the transformation "rules". Object can be either:
    • { transformDOM: ({ url, document, html, params }) => { ... return element-to-convert }, generateDocumentPath: ({ url, document, html, params }) => { ... return path-to-target; }} for a single mapping between one input document / one output file
    • { transform: ({ url, document, html, params }) => { ... return [{ element: first-element-to-convert, path: first-path-to-target }, ...] } for a mapping one input document / multiple output files (useful to generate multiple docx from a single web page)
  • config: object with several config properties
    • createDocumentFromString: this config is required if you use the methods in a non-browser context and want to pass document param as string. This method receives the HTML to parse as a string and must return a Document object.
    • setBackgroundImagesFromCSS: set to false to disable the background-image inlining in the DOM.

Importer UI

The Helix Importer has a dedicated browser UI: see https://github.com/adobe/helix-importer-ui

Installation

npm i https://github.com/adobe/helix-importer 

TODO: publish npm module

Usage

import { ... } from '@adobe/helix-importer';

版本与发布记录

@adobe/helix-importer 共发布 293 个版本,首次发布于 2022/01/19;过去 12 个月发布了 38 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.4.158latest2026/10/1920 天前
3.4.1572026/10/1820 天前
3.4.1562026/10/1325 天前
3.4.1552026/10/1325 天前
3.4.1542026/10/1226 天前
3.4.1532026/10/1127 天前

关于 @adobe/helix-importer 的常见问题

@adobe/helix-importer 是什么?

Helix Importer tool: create md / docx from html

如何安装 @adobe/helix-importer?

在项目目录运行 npm install @adobe/helix-importer,或使用 pnpm add / yarn add / bun add。

@adobe/helix-importer 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__helix-importer 是否存在。

@adobe/helix-importer 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adobe/helix-importer 可以商用吗?

@adobe/helix-importer 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/helix-importer 的下载量有多少?

根据 npm 官方下载统计,@adobe/helix-importer 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,724 次,日均约 91 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/helix-importer 还在维护吗?

最新版本 3.4.158 发布于 2026/10/19(20 天前);至今共发布 293 个版本,其中过去 12 个月发布了 38 个;首次发布于 2022/01/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。