2.0.3 • Published 2 years ago

@skyfury/reformat-markdown-cn v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

reformat-markdown-cn

Version node Build Status Coverage Status

例子

MarkDown 表格代码如下:

## 标题

| 姓名 | 电话 | 邮箱 |
| --- | :---: | ---: |
| 王顶 | 13582027613 | 408542507@qq.com |
| 郭玉朝 | 13812347652 | baldy@163.com |
|  | abc | def

通过 reformat-markdown-cn 工具的处理之后:

## 标题

| 姓名   |     电话     |              邮箱 |
|-------|:-----------:|-----------------:|
| 王顶   | 13582027613 | 408542507@qq.com |
| 郭玉朝 | 13812347652 |    baldy@163.com |
|       |     abc     |              def |

终端使用

编辑一个 MarkDown 文件, MarkDown 表格内容,运行下面的命令:

#格式化Markdown表格

npm i @skyfury/reformat-markdown-cn -g

reformat-markdown-cn -h

Usage: reformat-markdown-cn [options] <files|directories|globs>

Options:
  -V, --version          output the version number
  -R, --reformat [type]  check another rules and reformat markdown table, (default: {"0": 0, "1": 2, "2": 3, "3": 5})
  -C, --cat              only cat format markdown content (default: false)
  -h, --help             display help for command

#  1:2对应,合适等比字体
#  '{"0": 0, "1": 2}'
#  [默认] IDEA大致对应
#  '{"0": 0, "1": 2, "2": 3, "3": 5}'
#  自定义对应,按照需求自定义向后添加
#  '{"0": 0, "1": 2, "2": 3, "3": 5, "4": 7}'


# 格式化一个文件
reformat-markdown-cn ./markdown/example.md 
# 格式化多个文件
reformat-markdown-cn ./markdown/**/*.md
# 自定义字符对应
reformat-markdown-cn ./markdown/example.md -R '{"0": 0, "1": 2}'
reformat-markdown-cn ./markdown/**/*.md -R '{"0": 0, "1": 2}'
# 终端输出内容,不会覆盖源文件
reformat-markdown-cn ./markdown/example.md -R '{"0": 0, "1": 2}' -C
reformat-markdown-cn ./markdown/**/*.md -R '{"0": 0, "1": 2}' -C

代码使用

const { reformat } = require('@skyfury/reformat-markdown-cn')
const content = `
## 标题

| 姓名 | 电话 | 邮箱 |
| --- | :---: | ---: |
| 王顶 | 13582027613 | 408542507@qq.com |
| 郭玉朝 | 13812347652 | baldy@163.com |
|  | abc | def
`
const result = reformat(content)

console.log(result)
2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago