prettier-md
Apply Prettier to JavaScript code blocks of markdown files.
Installation
yarn global add prettier-md# or npm install -g prettier-md
Usage
prettier-md filename.mdprettier-md a.md b.md c.md
It searches all the JavaScript code blocks of specified files:
```js // JS code here will be processed by Prettier.. ```
Note that you must specify the js (```js
) to your code blocks. Currently prettier-md will write to the files directly and the operation can't be reverted, so backup your files or track them with git before running this tool.
You can also apply to a directory recursively. It will search all the files ended with .md
:
# Run prettier to the entire docs directory RECURSIVELY prettier-md docs
Options
Default options:
semi: false bracketSpacing: false
Other options are the same with Prettier's default. Please refer to https://github.com/prettier/prettier#api
Available options:
name: 'print-width' type: Number name: 'tab-width' type: Number name: 'use-tabs' type: Boolean name: 'semi' type: Boolean name: 'single-quote' type: Boolean name: 'trailing-comma' type: String name: 'bracket-spacing' type: Boolean name: 'jsx-bracket-same-line' type: Boolean name: 'parser ' type: String
Please refer to https://github.com/prettier/prettier#api for the option values.
Example usage:
prettier-md --semi --single-quote --parser=flow readme.md