npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@coding01/docsjs-markdown

v1.0.2

Published

Convert docsjs HTML snapshots and DOCX files to Markdown (Standard, GFM, YAML frontmatter)

Readme

@coding01/docsjs-markdown

面向 docsjs 生态的 Markdown 工具包。 可将 docsjs HTML 快照或 DOCX 文件转换为 Markdown,并支持可扩展规则。

npm version npm downloads License


English README

能力概览

  • HTML -> Markdown 主入口:@coding01/docsjs-markdown
  • DOCX -> Markdown 适配入口:@coding01/docsjs-markdown/docx
  • 基于规则的转换架构(支持按标签自定义规则)
  • 可选 YAML frontmatter 生成
  • CLI 支持直接 .docx -> .md

重点推荐:@coding01/docsjs

推荐与 @coding01/docsjs 配套使用:先用 docsjs 高保真导入 Word/DOCX,再将 HTML 快照交给 @coding01/docsjs-markdown 输出 Markdown。

  • npm: https://www.npmjs.com/package/@coding01/docsjs
  • GitHub: https://github.com/fanly/docsjs
  • 产品页: https://docsjs.coding01.cn/

单页模板规范

为了让 docsjs 生态插件页保持统一结构,单页遵循同一模板规范:

  • 规范文件:docs/LANDING_TEMPLATE.md
  • 实际页面:docs/index.html

安装

npm i @coding01/docsjs-markdown

快速开始

HTML 转 Markdown

import { htmlToGfm, htmlToStandardMarkdown } from "@coding01/docsjs-markdown";

const html = "<h1>Hello</h1><p>World</p>";
const gfm = htmlToGfm(html);
const standard = htmlToStandardMarkdown(html);

DOCX 转 Markdown

import { docxToMarkdown, docxToMarkdownWithMeta } from "@coding01/docsjs-markdown/docx";

const file = input.files?.[0] as File;

const markdown = await docxToMarkdown(file, {
  format: "gfm",
  frontmatter: true,
  sanitizationProfile: "fidelity-first",
});

const richResult = await docxToMarkdownWithMeta(file, {
  format: "gfm",
  frontmatter: true,
  includeParseReport: true,
});

自定义规则

import { htmlToMarkdown } from "@coding01/docsjs-markdown";

const markdown = htmlToMarkdown("<mark>hit</mark>", {
  rules: {
    mark: (el, ctx) => `==${ctx.convertInline(el)}==`,
  },
});

API

主入口:@coding01/docsjs-markdown

  • htmlToMarkdown(html, options)
  • htmlToMarkdownWithMeta(html, options)
  • htmlToGfm(html, options)
  • htmlToStandardMarkdown(html, options)
  • generateFrontmatter(meta)

子入口:@coding01/docsjs-markdown/docx

  • docxToMarkdown(file, options)
  • docxToMarkdownWithMeta(file, options)

配置项

  • format: "standard" | "gfm"
  • frontmatter: boolean
  • metadata: 自定义元数据
  • rules: 自定义标签转换规则
  • includeParseReport: 是否返回 docsjs 解析报告(docx 入口)
  • sanitizationProfile: "fidelity-first" | "strict"(docx 入口)

CLI

docsjs-markdown ./input.docx -o ./output.md --frontmatter --include-parse-report

可用参数:

  • -o, --output <file>
  • -f, --format <gfm|standard>
  • --frontmatter
  • --include-parse-report
  • --strict
  • -h, --help

开发

npm install
npm run verify
npm run build

发布规则

手动发布

npm version patch
git push origin main --follow-tags
npm publish --access public

建议 CI 规则(与 docsjs 一致)

  • 触发条件:tag v*.*.*
  • 质量门:npm run verify
  • 发包:npm publish --access public

GitHub Packages(仓库侧边栏 Packages)

  • 工作流:.github/workflows/publish-github-packages.yml
  • 触发条件:tag v*.*.* 或手动触发
  • 目标仓库:https://npm.pkg.github.com
  • GitHub Packages 包名:@fanly/docsjs-markdown

License

MIT

打赏支持

如果这个项目帮你节省了时间,欢迎打赏支持。

支持 docsjs