You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
toolkit-md check ./docs --category lint --category link
130
+
```
131
+
99
132
## Configuration
100
133
101
134
Toolkit for Markdown supports configuration through:
@@ -120,19 +153,26 @@ Toolkit for Markdown supports configuration through:
120
153
|`ai.exemplars`|`--exemplar`|`TKMD_AI_EXEMPLAR_*`| Path to directory of content to use as an example to follow, can be specified multiple times |`[]`|
121
154
|`ai.styleGuides`|`--style-guide`|`TKMD_AI_STYLE_GUIDE_*`| Path to style guide file, can be specified multiple times |`[]`|
122
155
|`ai.includeImages`|`--include-images`|`TKMD_AI_INCLUDE_IMAGES`| Include images from markdown files in AI review |`false`|
123
-
|`ai.imageBasePath`|`--image-base-path`|`TKMD_AI_IMAGE_BASE_PATH`| Base path for resolving absolute image paths |`contentDir`|
124
156
|`ai.maxImages`|`--max-images`|`TKMD_AI_MAX_IMAGES`| Maximum number of images to include per file |`5`|
125
157
|`ai.maxImageSize`|`--max-image-size`|`TKMD_AI_MAX_IMAGE_SIZE`| Maximum image file size in bytes |`3145728` (3MB) |
126
158
|`ai.review.instructions`|`--instructions`|`TKMD_AI_REVIEW_INSTRUCTIONS`| Additional instructions for the model |`undefined`|
127
159
|`ai.review.summaryFile`|`--summary-file`|`TKMD_AI_REVIEW_SUMMARY_PATH`| Write a summary of the review changes to the provided file path in Markdown format |`""`|
128
160
|`ai.review.diffFile`|`--diff-file`|`TKMD_AI_REVIEW_DIFF_FILE`| Path to unified diff file for filtering review suggestions |`undefined`|
129
161
|`ai.review.diffContext`|`--diff-context`|`TKMD_AI_REVIEW_DIFF_CONTEXT`| Number of context lines around changed lines to include (symmetric) |`3`|
162
+
|`ai.review.runChecks`|`--review-check`|`TKMD_AI_REVIEW_CHECK`| Run content checks and include results in the review prompt |`true`|
130
163
|`ai.translation.force`|`--force`|`TKMD_AI_FORCE_TRANSLATION`| Force translation even if source unchanged |`false`|
131
164
|`ai.translation.check`|`--check`|`TKMD_AI_CHECK_TRANSLATION`| Only check if translation needed |`false`|
132
165
|`ai.translation.directory`|`--translation-dir`|`TKMD_AI_TRANSLATION_DIRECTORY`| Directory where translated content is stored, if not specified defaults to source directory |`undefined`|
133
166
|`ai.translation.skipFileSuffix`|`--skip-file-suffix`|`TKMD_AI_TRANSLATION_SKIP_FILE_SUFFIX`| Omit the language code suffix for translated files ('example.fr.md' becomes 'example.md') |`false`|
167
+
|`check.minSeverity`|`--min-severity`|`TKMD_CHECK_MIN_SEVERITY`| Minimum severity level to report (error, warning) |`"warning"`|
168
+
|`check.categories`|`--category`|`TKMD_CHECK_CATEGORY_*`| Check categories to run (lint, link, image), can be specified multiple times |`["lint", "link", "image"]`|
169
+
|`check.links.timeout`|`--link-timeout`|`TKMD_CHECK_LINK_TIMEOUT`| Timeout in milliseconds for HTTP link and image checks |`5000`|
170
+
|`check.links.skipExternal`|`--skip-external-links`|`TKMD_CHECK_SKIP_EXTERNAL_LINKS`| Skip validation of external HTTP/HTTPS links and images |`false`|
171
+
|`check.lint.ignoreRules`|`--ignore-rule`|`TKMD_CHECK_LINT_IGNORE_RULE_*`| Markdownlint rule names or aliases to ignore, can be specified multiple times |`[]`|
172
+
|`staticPrefix`|`--static-prefix`|`TKMD_STATIC_PREFIX`| URL prefix indicating a link points to a file in the static directory |`undefined`|
173
+
|`staticDir`|`--static-dir`|`TKMD_STATIC_DIR`| Directory relative to the cwd where static assets are stored, used with staticPrefix |`undefined`|
134
174
135
-
**Note:** For array values (exemplars, styleGuides), the environment variable referenced above is treated as a prefix: `TKMD_AI_EXEMPLAR_FIRST`, `TKMD_AI_EXEMPLAR_SECOND`, etc.
175
+
**Note:** For array values (exemplars, styleGuides, ignoreRules), the environment variable referenced above is treated as a prefix: `TKMD_AI_EXEMPLAR_FIRST`, `TKMD_AI_EXEMPLAR_SECOND`, etc.
136
176
137
177
### Configuration File Format
138
178
@@ -155,14 +195,29 @@ Create a `.toolkit-mdrc` file in JSON format:
@@ -317,7 +372,7 @@ The review command can extract and include images referenced in markdown files f
317
372
**Image Path Resolution:**
318
373
319
374
-**Relative paths** (e.g., `./images/diagram.png`, `../assets/photo.jpg`) are resolved from the markdown file's directory
320
-
-**Absolute paths** (e.g., `/images/diagram.png`) are resolved from the `imageBasePath` configuration (defaults to `contentDir`, resolved from current working directory)
375
+
-**Absolute paths** (e.g., `/images/diagram.png`) are resolved against the `staticDir` directory. If `staticPrefix` is configured and the path starts with it, the prefix is stripped before resolution
321
376
-**Remote URLs** (e.g., `https://example.com/image.png`) are excluded from processing
322
377
323
378
**Image Limits:**
@@ -329,7 +384,7 @@ The review command can extract and include images referenced in markdown files f
Validates Markdown content without AI by running linting checks (via markdownlint), verifying that local link targets exist, and confirming that referenced images are present. Remote links and images are validated with HTTP HEAD requests. This command requires no AWS credentials and is suitable for CI pipelines. Exits with code 1 if any errors are found.
Starts an MCP server that exposes tool features to MCP clients. See below for further information.
@@ -530,6 +621,7 @@ The following MCP tools are provided:
530
621
|`content_best_practices`| Response contains style guide and exemplar content as configured for the specified project. It the `targetLanguage` is provided it will also load style guides for that language and provide them in the response. |
531
622
|`content_review_guidance`| Response contains guidance for the model to systematically review Markdown content for a given project for general issues and best practices. |
532
623
|`content_translation_guidance`| Response contains guidance for the model to translate Markdown for a given project to another language. It helps the model locate both source content as well as existing translated content to use for context. |
624
+
|`run_checks`| Runs lint, link, and image checks on specified Markdown content files relative to the content directory. Supports filtering by severity and category. |
@@ -33,11 +34,28 @@ const template = `Your task is to review the content provided for file "{{file}}
33
34
The images for the file to review have been included as attachments. Ensure that the descriptions of the images in the Markdown match the contents of each image.
34
35
{{/if}}
35
36
37
+
{{#if checkIssues}}
38
+
The following issues were detected by automated content checks:
39
+
40
+
{{#each checkIssues}}
41
+
- Line {{this.line}}: [{{this.severity}}] {{this.message}} ({{this.category}}/{{this.rule}})
42
+
{{/each}}
43
+
44
+
The above issues will highlight if any images or links in the content failed to resolve.
45
+
{{/if}}
46
+
36
47
{{#if instructions}}
37
48
In additional you've been provided the following additional instructions:
38
49
{{{instructions}}}
39
50
{{/if}}
40
51
52
+
For any finding which cannot be reliably remediated, such as missing images or broken links, leave the offending Markdown but insert a comment above it like so:
53
+
54
+
<example_comment>
55
+
<!-- TMD finding: This image '/pods1.png' could not be loaded -->
56
+
[Some screenshot](/pods1.png)
57
+
</example_comment>
58
+
41
59
Write the output as markdown in a similar style to the example content. Respond with the resulting file enclosed in <file></file> including the path to the file as an attribute.
42
60
43
61
ONLY respond with the content between the "<file></file>" tags.`;
@@ -49,11 +67,13 @@ export async function buildReviewPrompt(
49
67
contextStrategy: ContextStrategy,
50
68
styleGuides: string[],
51
69
exemplars: Exemplar[],
52
-
imageBasePath: string,
53
70
instructions?: string,
54
71
includeImages: boolean=false,
55
72
maxImages: number=5,
56
73
maxImageSize: number=3145728,
74
+
staticPrefix?: string,
75
+
staticDir?: string,
76
+
checkIssues?: CheckIssue[],
57
77
): Promise<Prompt>{
58
78
constpromptTemplate=Handlebars.compile(template);
59
79
@@ -72,6 +92,7 @@ export async function buildReviewPrompt(
0 commit comments