Remove "format-" prefix from --markdown-file arguments

This commit is contained in:
Nick Lockwood
2025-07-20 21:35:05 +01:00
committed by Cal Stephens
parent 23ef0a350c
commit e6f0df6be5
3 changed files with 10 additions and 10 deletions
+6 -7
View File
@@ -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 `{`.
+2 -1
View File
@@ -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
+2 -2
View File
@@ -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