https://github.com/hugomods/prettier-config
Prettier config for Hugo for formatting HTML templates, Markdown, JSON, TOML and YAML
https://github.com/hugomods/prettier-config
html hugo json markdown prettier toml yaml
Last synced: 22 days ago
JSON representation
Prettier config for Hugo for formatting HTML templates, Markdown, JSON, TOML and YAML
- Host: GitHub
- URL: https://github.com/hugomods/prettier-config
- Owner: hugomods
- License: mit
- Created: 2024-05-23T05:37:29.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-13T13:18:22.000Z (11 months ago)
- Last Synced: 2024-06-17T10:08:56.329Z (11 months ago)
- Topics: html, hugo, json, markdown, prettier, toml, yaml
- Homepage: https://hugomods.com/
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# HugoMods Prettier Config
This is a Prettier [config](https://github.com/hugomods/prettier-config/blob/main/index.json) for Hugo to format HTML templates, Markdown files, data files, i18n files and so on.
[](https://github.com/hugomods/prettier-config/blob/main/LICENSE)
[](https://www.npmjs.com/package/@hugomods/prettier-config)
[](https://www.npmjs.com/package/@hugomods/prettier-config)## Installation
```sh
npm i -D @hugomods/prettier-config
```## Configuration
Configure the following settings on `package.json`.
```json
{
"prettier": "@hugomods/prettier-config",
"scripts": {
"lint:prettier": "prettier . --check",
"lint:prettier:fix": "prettier . -w"
}
}
```## Scripts
### Check If Files Is Formatted Correctly
```sh
npm run lint:prettier
```### Format Files In Place
```sh
npm run lint:prettier:fix
```## GitHub Actions
To check if files are formatted correctly via GitHub Actions, you can create a workflow as follows, takes `.github/workflows/lint.yml` as an example.
```yaml
name: linton:
push:jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint:prettier
```