This is a plugin developed for Obsidian to format markdown files using the popular code formatter Prettier.
Firstly, clone the project to your local disk by running the following command:
git clone https://github.com/BUR4KBEY/obsidian-prettier.git
Then, install the dependencies using yarn:
cd obsidian-prettier
yarn
Next, build the project by running the following command:
yarn build
Alternatively, you can run the yarn dev
command for development purposes.
To install the plugin, follow these steps:
- Navigate to your Obsidian vault and find the
.obsidian
folder. - Create a new folder called
obsidian-prettier
inside the.obsidian/plugins
directory. - Copy
main.js
andmanifest.json
files into theobsidian-prettier
folder. - Enable the plugin from the Obsidian settings. (Community plugins > Prettier Formatter)
To use the plugin, you need to create a configuration file.
Create a new folder called config
, and then create a new file called prettierrc
inside that folder. (You can use any names you like)
The file content must follow this structure:
```json
{
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid"
}
```
You can write your Prettier configuration inside the JSON object.
To use this configuration file, specify the path by opening Prettier Formatter
in the Community Plugins section and writing the path. (config/prettierrc
)
Once you have set up the path, you can press CTRL + P
to open the command palette and type format document
, then run it to format the document according to your configuration.