Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions qlty-plugins/plugins/linters/mdformat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Mdformat

[Mdformat](https://github.com/hukkin/mdformat) is an opinionated CommonMark compliant Markdown formatter.

## Enabling Mdformat

Enabling with the `qlty` CLI:

```bash
qlty plugins enable mdformat
```

Or by editing `qlty.toml`:

```toml
# Always use the latest version
[plugins.enabled]
mdformat = "latest"

# OR enable a specific version
[plugins.enabled]
mdformat = "X.Y.Z"
```

## Configuration files

- [`.mdformat.toml`](https://mdformat.readthedocs.io/en/stable/users/configuration_file.html)

To keep your project tidy, you can move configuration files into `.qlty/configs` and Qlty will find and use them when running Mdformat.

## Links

- [Mdformat on GitHub](https://github.com/hukkin/mdformat)
- [Mdformat documentation](https://mdformat.readthedocs.io/)
- [Mdformat plugin definition](https://github.com/qltysh/qlty/tree/main/plugins/linters/mdformat)
- [Mdformat on PyPI](https://pypi.org/project/mdformat/)
- [Qlty's open source plugin definitions](https://github.com/qltysh/qlty/tree/main/plugins/linters)

## License

Mdformat is licensed under the [MIT License](https://github.com/hukkin/mdformat/blob/master/LICENSE).
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`linter=mdformat fixture=basic version=1.0.0 1`] = `
{
"issues": [
{
"category": "CATEGORY_STYLE",
"level": "LEVEL_FMT",
"location": {
"path": "basic.in.md",
},
"message": "Incorrect formatting, autoformat by running \`qlty fmt\`.",
"mode": "MODE_BLOCK",
"onAddedLine": true,
"ruleKey": "fmt",
"tool": "mdformat",
},
],
}
`;
14 changes: 14 additions & 0 deletions qlty-plugins/plugins/linters/mdformat/fixtures/basic.in.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Header with extra spaces

Some text with multiple spaces.

* inconsistent list
* formatting
*here

> a blockquote
>with no space

```python
def foo():pass
```
3 changes: 3 additions & 0 deletions qlty-plugins/plugins/linters/mdformat/mdformat.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { linterCheckTest } from "tests";

linterCheckTest("mdformat", __dirname);
19 changes: 19 additions & 0 deletions qlty-plugins/plugins/linters/mdformat/plugin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config_version = "0"

[plugins.definitions.mdformat]
runtime = "python"
package = "mdformat"
file_types = ["markdown"]
config_files = [".mdformat.toml"]
latest_version = "1.0.0"
known_good_version = "1.0.0"
version_command = "mdformat --version"
description = "CommonMark compliant Markdown formatter"

[plugins.definitions.mdformat.drivers.format]
script = "mdformat ${target}"
success_codes = [0]
output = "rewrite"
cache_results = true
batch = true
driver_type = "formatter"
Loading