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

md-padding

v1.9.2

Published

修复 Markdown 中的混排空格:中英文、数字、链接等。

Downloads

120

Readme

Markdown Padding

npm version downloads Check Release Coveralls semantic-release GitHub issues DUB license Commitizen friendly

排版中只有空格不能忍,修复你 Markdown 中缺少的空格:

  • 中英文混排时,中文英文 之间,中文数字 之间添加空格。
  • 特定英文标点 后面添加空格,但 全角标点 前后不加空格。
  • 文字和 行内代码 之间、文字与 链接 之间、文字与 加粗强调删除线 之间添加空格。
  • 会解析生成 Markdown + 自然语言构成的 AST,最大限度解决问题同时避免误处理。

这里 有个例子:

raw.md 和 formated.md 之间的 Diff

使用说明

在命令行使用

可以 npm i -g md-padding 后使用,也可以用 npx md-padding

# 输出 README.md 格式化后的内容
npx md-padding README.md

还可以接受标准输入(用在管道中),也可以原址(in-place)更改文件。详见 md-padding --help

> npx md-padding --help
md-padding [OPTION]... <FILE>

Options:
  --help, -h      Show help                  [boolean]
  --version       Show version number        [boolean]
  --in-place, -i  edit file in place         [boolean]
  --ignore-words, -I  ignore padding within/before/after these words  [string]
  --ignore-patterns, -P  ignore by a list of regexp  [string]
  --read-files, -r    read a file list containing one file per line, use empty value to read from STDIN  [string]

Examples:
  stdout    md-padding README.md
  in-place  md-padding -i README.md
  pipe      cat README.md | md-padding
  ignore-words  cat README.md | md-padding -I '=' '::'
  ignore-patterns  cat README.md | md-padding -P '=' ':+'
  batch format  cat list.txt | md-padding -r -i
  equivalent w/ md-padding -r list.txt -i

在 Vim 中使用

可以绑定一个快捷键 F6 来修复当前文件:

" 绑一个 Vim Filter
noremap <buffer> <F6> <Esc>:%!npx md-padding<CR>

在 VS Code 中使用

从 Marketplace 安装 Markdown Padding。 打开一个 Markdown 文件后,支持这些操作:

  • Command。打开 命令面板,输入 Markdown Padding 并回车。命令面板 快捷键:
    • Windows:Ctrl + Shift + P
    • Mac:Command + Shift + P
    • Linux:Ctrl + Shift + P
  • Formatting。在编辑器里右键点格式化,或者:
    • Windows:Shift + Alt + F
    • Mac:Shift + Option + F
    • Linux:Ctrl + Shift + I

参数 | 类型 | 描述 --- | --- | --- mdpadding.ignoreWords | Array<string> | 这些字词内部和前后禁止加空格 mdpadding.ignorePatterns | Array<string> | 这些正则内部和前后禁止加空格

功能说明

中英混排

中英混排的正文内容,会确保中英之间的空格。

标点符号

需要空格的标点(比如半角逗号),会在适当的位置追加空格。

代码注释

代码格式化不是本仓库的功能之一,请使用对应语言的 prettifier。但代码中的注释会被当做 Markdown 正文来格式化,目前支持这些语言的注释:

  • cpp, c, java, javascript, typescript, csharp, go
  • sql
  • bash, python, ruby

忽略片段

有些片段希望保持原状,这时可以用 md-padding-ignore 来包裹起来。

下面是一段不需要格式化的文本
<!--md-padding-ignore-begin-->
a*b=c, b>1 => a<c
<!--md-padding-ignore-end-->
现在开始又可以格式化了。