This is a developer-oriented markdown development tool that provides a relatively uniform format for the markdown
user.
After the installation is complete, you will need to restart your vscode.
In any markdown
standard file with a .md
suffix, you can use shift+option+f
to quickly format the code.
PS: It does not fix your markdown syntax errors, for example, there is no space after
#
as a title , because in the code # is a usable character that is widely used as a comment or variable declaration.
- For
。 ;;! ? :
Add a space after these symbols; ,,:;!“”‘’()?
, unify it as a half-width character(Optional);- a space before and after the back-quote;
- Empty a line for the title;
- Empty a line for the code block;
- The table is aligned automatically;
- Empty a line for the link block;
- erase dulicated line;
- Format the code, by
js-beautify
tool, currently only thejavascript
language;
-
code area
function sayHello() {console.log('hello')}
Will always be formatted according to js syntax, if
codeAreaFormat
istrue
(default)- code block
function sayHello() {console.log('hello')}
� If
lang
isjs
orjavascript
or empty, it will be formatted according to js syntax.
The js formatting rules can be configured in
settings.json
.
VSCode version 1.29.1 (macOS Mojave)
enable = config.get<boolean>('enable', true); // enable/disable markdown-formatter
commaEN: string = config.get<string>('commaEN', ''); // fullwidth character translate into halfwidth character
formatOpt = config.get<any>('formatOpt', {}); // enable/disable format code or config beautifyjs(false: disable format code , {}: config beautifyjs)
How to config beautifyjs, you can clickhere
If you have any ideas, please contact me.
email: mydiamervin@gmail.com
or
这是个面向开发者的文档(markdown)开发工具,为markdown
使用者提供了相对统一的格式。
安装完成以后,你需要重新启动你的vscode。
在任何.md
为后缀的markdown
标准文件中,都可以使用 shift+option+f
快速格式化代码。
注意 它并不会修复你的markdown语法错误,例如作为标题,#
后没有加空格,这是因为在代码中#是一个可用字符,广泛得用作注释或变量声明。
-
。;;!、?:
这些符号后添加一个空格; -
,,:;!“”‘’()?
,转换为半角符(可选); -
反逗号前后空一格;
-
标题上下空出一行;
-
代码块上下空出一行;
-
表格自动对齐;
-
为引用上下空出一行;
-
相邻的空行合并;
-
依据配置会格式化代码块中代码,依据
js-beautify
工具,目前只有javascript
语言-
代码区
function sayHello() {console.log('hello')}
总是会被按照js语法格式化,如果
codeAreaFormat
为true
(默认值) -
代码块
function sayHello() {console.log('hello')}
�如果
lang
为js
或者javascript
或者为空,会按照js语法格式化。 -
编辑
VS Code
的settings.json
可以配置js格式化规则.
VSCode 版本 1.29.1 (macOS Mojave)
enable = config.get<boolean>('enable', true); // 是否启用格式化
commaEN: string = config.get<string>('commaEN', ''); // 全角符号转化为半角符号
formatOpt = config.get<any>('formatOpt', {}); // 是否格式化代码或者配置beautifyjs(false: 不格式化代码,{}: 配置beautifyjs)
let codeAreaFormat: boolean = config.get<boolean>('codeAreaFormat', true);
配置beautifyjs, 可以参考这里
如果你有任何想法,请联系我
email: mydiamervin@gmail.com
或者