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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yyp-md2html

v0.0.2

Published

convert markdown documentation to html and show on the browser

Downloads

3

Readme

md2html

这是一个markdown文档阅读器命令行工具。它可以将指定的markdown文件转化为对应的html文档,在浏览器中展示,同时,你也可以将指定的markdown文档或指定的目录中的markdown文档转化成html文档存储于指定文件或目录中。

Usage

###. 安装

npm install yyp-md2html -g

命令

基本命令:

md2html sourcePath distPath 

其中,sourcePath指的是目标文件地址(必填参数),distPath指的是目标文件地址(选填参数)。

sourcePath可以是一个文件地址,也可以是一个目录。

当sourcePath是文件路径时,该文件必须是markdown文件,否则会报错。此时可以做一下两种操作:

  1. 直接将转换好的文件用浏览器进行展示,该操作不需要传递第二个参数

  2. 将转换后的文件存入本地系统中,此操作需要额外提供--local参数 开启该功能。此时,如果用户没有提供distPath,则直接将转化后的文档存储为同名html文件,在存放到源文件坐在目录;如果用户提供了distPath参数,且distPath是一个文件路径,则必须是html文件路径,转化后的文件存储到该路径上;如果distPath是一个目录路径,将转化后的文档存储为同名html文件,在存放到该路径下。

例子

  1. 将当前目录下的test.md文件在浏览器中展示(此时源路径必须指向md文件)
md2html ./test.md
  1. 将当前目录下的test.md文件存储到当前目录下,并且命名为test.html
md2html ./test.md --local
  1. 将当前目录下的test.md文件存储到当前目录下的index.html(必须为htm)文件中,如果不存在,创建该文件
md2html ./test.md ./index.html --local
  1. 将当前目录下的test.md文件存储到/tmp目录下,并且命名为test.html
md2html ./test.md ./tmp --local
  1. 将当前目录下src目录下的所有文件进行相应操作(markdown文件转化为html其他文件直接复制)存储到当前目录下dist目录下
md2html ./src ./dist --local

命令其他参数介绍

  1. --port=port(如,--port=9090), 在浏览器中展示文档时,启动的本地服务器默认为9000,如果出现冲突,可以自定义端口;

  2. --local,为功能开关,提供后,转化后的markdown文档会存储在相应的文件夹中,而不是在浏览器中展示;

  3. --tmp=path(如,--tmp=/tmp),默认值为/tmp/md2html,指定临时存放文档的位置,该参数只在浏览器中展示文档时有效;

  4. --cssurl=path(--cssurl=./base.css),指定转化后的页面的基本样式,可用户根据实际情况进行指定;

注意事项

  1. 如果直接展示的markdown文档中带有图片,此时图片无法显示;如果希望可以正常显示,可以当文档直接转化为html文件后存储到本地,再用浏览器访问。

  2. 如果对操作的markdown文档进行修改后,无需再次执行指令,直接刷行网页,即可得到最新的内容。

效果展示

README.md