mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-05-17 10:30:35 +00:00
Remove "format-" prefix from --markdown-file arguments
This commit is contained in:
committed by
Cal Stephens
parent
23ef0a350c
commit
e6f0df6be5
@@ -901,26 +901,25 @@ SwiftFormat can format Swift code blocks inside Markdown files (`.md`). This is
|
||||
```
|
||||
````
|
||||
|
||||
To format Swift code blocks in markdown files, use the `--markdown-files` option with either `format-strict` or `format-lenient`:
|
||||
To format Swift code blocks in markdown files, use the `--markdown-files` option with either `strict` or `lenient`:
|
||||
|
||||
```bash
|
||||
$ swiftformat . --markdown-files format-strict
|
||||
$ swiftformat . --markdown-files format-lenient
|
||||
$ swiftformat . --markdown-files strict
|
||||
$ swiftformat . --markdown-files lenient
|
||||
```
|
||||
|
||||
Or add it to your `.swiftformat` config file:
|
||||
|
||||
```
|
||||
--markdown-files format-strict
|
||||
--markdown-files format-lenient
|
||||
--markdown-files strict
|
||||
```
|
||||
|
||||
**Formatting modes:**
|
||||
|
||||
SwiftFormat supports two modes for handling markdown files:
|
||||
|
||||
- `format-lenient` (default): Ignores parsing errors in code blocks and continues formatting
|
||||
- `format-strict`: Fails if any code blocks contain parsing errors
|
||||
- `lenient` (default): Ignores parsing errors in code blocks and continues formatting
|
||||
- `strict`: Fails if any code blocks contain parsing errors
|
||||
|
||||
SwiftFormat's tokenizer is more permissive than the Swift compiler and typically only emits errors when encountering unbalanced scope tokens like `(` or `{`.
|
||||
|
||||
|
||||
@@ -1416,7 +1416,8 @@ struct _Descriptors {
|
||||
argumentName: "markdown-files",
|
||||
displayName: "Markdown Files",
|
||||
help: "Swift in markdown files:",
|
||||
keyPath: \.markdownFiles
|
||||
keyPath: \.markdownFiles,
|
||||
altOptions: ["format-lenient": .lenient, "format-strict": .strict]
|
||||
)
|
||||
|
||||
// MARK: - DEPRECATED
|
||||
|
||||
@@ -1123,9 +1123,9 @@ public enum MarkdownFormattingMode: String, CaseIterable {
|
||||
/// Swift code in markdown files is ignored (default)
|
||||
case ignore
|
||||
/// Errors in markdown code blocks are ignored
|
||||
case lenient = "format-lenient"
|
||||
case lenient
|
||||
/// Errors in markdown code blocks are reported
|
||||
case strict = "format-strict"
|
||||
case strict
|
||||
}
|
||||
|
||||
/// File enumeration options
|
||||
|
||||
Reference in New Issue
Block a user