Skip to content

Commit a4fd46a

Browse files
committed
fix(build): update synopsis extraction regex to handle language identifiers
Fix the extract_synopsis() regex in build-website.py to properly capture synopsis content when code blocks have language specifiers (e.g., ```text). The previous regex captured the language identifier instead of the actual synopsis line. The new regex skips optional language identifiers and captures the first content line. This fixes the incorrect 'text' placeholder values for security plugin commands in docs/data.json. Fixes: - image-grades synopsis: now '/security:image-grades <config.yaml> [--grade <grades>] [--email]' - set-image-grade-tool-path synopsis: now '/security:set-image-grade-tool-path <path>' Resolves CodeRabbit critical issue in docs/data.json.
1 parent d9e4dbb commit a4fd46a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,13 @@
291291
{
292292
"name": "image-grades",
293293
"description": "Generate container vulnerability grade report using container-grade-reporter",
294-
"synopsis": "text",
294+
"synopsis": "/security:image-grades <config.yaml> [--grade <grades>] [--email]",
295295
"argument_hint": "<config.yaml> [--grade <grades>] [--email]"
296296
},
297297
{
298298
"name": "set-image-grade-tool-path",
299299
"description": "Configure the path to container-grade-reporter tool",
300-
"synopsis": "text",
300+
"synopsis": "/security:set-image-grade-tool-path <path>",
301301
"argument_hint": "<path>"
302302
}
303303
],

scripts/build-website.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def parse_frontmatter(content: str) -> Dict[str, str]:
2525

2626
def extract_synopsis(content: str) -> str:
2727
"""Extract synopsis from command markdown"""
28-
match = re.search(r'## Synopsis\s*```\s*([^\n]+)', content, re.MULTILINE)
28+
# Match Synopsis header, optional language identifier, then capture the next non-empty line
29+
match = re.search(r'## Synopsis\s*```(?:\w+)?\s*\n([^\n]+)', content, re.MULTILINE)
2930
if match:
3031
return match.group(1).strip()
3132
return ""

0 commit comments

Comments
 (0)