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

@liangtf/docx2html

v0.0.1-beta.1

Published

docx to html for protocol file

Readme

docx2html

根据mammoth进行二次开发,旨在将docx格式的协议文件转为html文件

安装

npm install @liangtf/docx2html -g

使用介绍

usage: docx2html [-h] [-v] [-w] docx-path [output-path]

positional arguments:
  docx-path      Path to the .docx file to convert.
  output-path    Output path for the generated document. Images will be stored inline in the output document. Output is written to stdout if not set.

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version 
  -w, --watch    enter watching mode

用法1

直接把结果输出在终端上

  docx2html demo.docx

用法2

把结果保存在demo.html

  docx2html demo.docx  demo.html

用法3

加上参数-w,本地起服务,实时监听docx文件变化从而刷新页面,保存在demo.html

  docx2html demo.docx  demo.html -w

转化规则

所有px单位按设计稿比例转化为vw单位

容器

协议内容被套在里面<div id="#app">协议内容</div>

#app{
    margin: 0 pxToVW(60) pxToVW(183);
    color: rgba(0, 0, 0, 0.45);
    font-size: pxToVW(42);
}

主标题

docx文档中标题 1样式,转化成<h1 class="head1">主标题</h1>

.head1 {
  color: rgba(0, 0, 0, 0.9);
  font-size: pxToVW(72);
  line-height: 1.17;
  text-align: center;
  margin: pxToVW(156) 0 pxToVW(108);
}

demo

二级标题

docx文档中标题 2样式,转化成<h2 class="head2">二级标题</h1>

.head2 {
  color: rgba(0, 0, 0, 0.9);
  font-size: pxToVW(45);
  line-height: 1.47;
  text-align: left;
  margin: pxToVW(84) 0 pxToVW(30);
}

正文内容

所有段落都转成p标签包裹

#app>p {
  margin: 0 0 pxToVW(24) 0;
  line-height: 1.64;
  text-align: left;
}

整段落缩进

有缩进的段落会转换为<div class="paragraph-indent"></div>

.paragraph-indent {
  margin-left: 1em;
  & > p {
    &:first-child{
      margin-top: - pxToVW(12);
    }
    margin: 0 0 pxToVW(24) 0;
    line-height: 1.64;
    text-align: left;
    margin-bottom: pxToVW(12);
  }
}

加粗

有加粗样式的都会转为<strong>需要加粗的文字</strong>

strong{
  color: rgba(0, 0, 0, 0.9);
}

下划线

有下划线样式的都会转为<span class="text-underline">需要有下划线的内容</span>

.text-underline{
  text-decoration: underline;
}

底部备注内容

只提供样式,不会自动转换标签,一般用于更新时间等等

.footer-title {
  color: rgba(0,0,0,0.25);
  font-size: pxToVW(36);
  line-height: 1.17;
  margin-top: pxToVW(36);
}