diff --git a/README.md b/README.md index e3bf0eb..c400e8c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ ## Using lintguard -### Add `lintguard` metadata to codeblocks in Markdown files -In any Markdown (.md) file, you can augment a codeblock with extra metadata, consider a hypothetical README.md file with the following codeblock appearing somewhere: +### Add `lintguard` to codeblocks in Markdown files +In any Markdown (.md) file, you can augment a codeblock with lintguard notation. + +Consider a hypothetical README.md file with the following codeblock appearing somewhere:
-```swift lintguard: ./Package.swift#L1-L19
+```swift lintguard: Package.swift#L1-L19
 // swift-tools-version: 5.9
 // The swift-tools-version declares the minimum version of Swift required to build this package.
 
@@ -27,15 +29,14 @@ let package = Package(
 
The main bit of interest is the first line -```swift lintguard: ./main.swift#L1-L2 +```swift lintguard: Package.swift#L1-L19 - the first three backticks ``` are the start of a standard markdown code block - `swift` bit is also standard in markdown is the language identifier - after the language identifier we see the token `lintguard:` this indicates to lintguard that this code block should be checked -- after the `lintguard` token, we see `./main.swift` this indicates that the codeblock is referencing the `main.swift` file -- after the filename, we see `#L1-L2`, this means that the codeblock matches lines 1-2 of the `main.swift` file - +- after the `lintguard` token, we see `Package.swift` this indicates that the codeblock is referencing the `Package.swift` file +- after the filename, we see `#L1-L19`, this means that the codeblock matches lines 1-19 of the `Package.swift` file -### Using lintguard to detect out of date codeblocks in Markdown files +### Using lintguard to detect out of date codeblocks Consider the hypothetical README.md from the previous section, once the tool is installed, simply invoke it with the paths to one or more Markdown (.md) files: ``` $ lintguard README.md @@ -43,21 +44,21 @@ $ lintguard README.md If any `lintguard` code blocks exist in README.md, lintguard will process them to ensure any guarded code blocks are up-to-date -We can even use it on the README.md file you are currently reading: +We can even use it on the `README.md` file you are currently reading: -This is line 31, Hello World! +This is line 49, Hello World! This code block will pass: ```` -```markdown lintguard: ./README.md#L48 -This is line 31, Hello World! +```markdown lintguard: README.md#L49 +This is line 49, Hello World! ``` ```` And this one will fail: ```` -```markdown lintguard: ./README.md#L48 -This is line 31, Hello? +```markdown lintguard: README.md#L49 +This is line 49, Hello? ``` ````