Skip to content

Commit efd6e00

Browse files
raifdmuellerclaude
andcommitted
fix: Resolve remaining CodeRabbit issues in adocToMarkdown converter
- Fix missing blank line after table: return '\n\n' from convertAdocTable - Move cross-reference resolution before def-list conversion so terms like <<spc,SPC>>:: are correctly expanded before matching - Use non-greedy term matching in def-list regex ([^\n|#`>]+?) to handle terms containing colons (e.g. "Anti-pattern: Ice cream cone::") Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 11dcdb5 commit efd6e00

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

scripts/generate-llms-txt.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function convertAdocTable(body) {
5959
for (const row of rows.slice(1)) {
6060
if (row.length > 0) out.push('| ' + row.join(' | ') + ' |')
6161
}
62-
return out.join('\n')
62+
return out.join('\n') + '\n\n'
6363
}
6464

6565
// ─── AsciiDoc → Markdown converter ──────────────────────────────────────────
@@ -100,17 +100,6 @@ function adocToMarkdown(adoc) {
100100
// AsciiDoc line continuation (+) → remove
101101
md = md.replace(/^\+\s*$/gm, '')
102102

103-
// Nested definition lists: term::: description → - **term**: description
104-
md = md.replace(/^([^:\n|#`>]+):::[^\S\n]*(.*)$/gm, (_, term, desc) =>
105-
desc.trim() ? `- **${term.trim()}**: ${desc.trim()}` : `- **${term.trim()}**`
106-
)
107-
108-
// Definition lists: term:: description → **term**: description
109-
// Use [^\S\n]* (horizontal whitespace only) to avoid matching across newlines
110-
md = md.replace(/^([^:\n|#`>]+)::[^\S\n]*(.*)$/gm, (_, term, desc) =>
111-
desc.trim() ? `**${term.trim()}**: ${desc.trim()}` : `**${term.trim()}**`
112-
)
113-
114103
// Links: link:url[text] → [text](url), resolve relative .adoc paths to GitHub URLs
115104
md = md.replace(/link:([^\[]+)\[([^\]]*)\]/g, (_, url, text) => {
116105
if (/^\.\.\/.*\.adoc$/.test(url)) {
@@ -120,9 +109,22 @@ function adocToMarkdown(adoc) {
120109
})
121110

122111
// Cross-references: <<id,text>> → text, <<id>> → `id`
112+
// Must run before def-list conversion so terms like <<spc,SPC>>:: are resolved first
123113
md = md.replace(/<<([^,>]+),([^>]+)>>/g, '$2')
124114
md = md.replace(/<<([^>]+)>>/g, '`$1`')
125115

116+
// Nested definition lists: term::: description → - **term**: description
117+
// Non-greedy term match allows colons in term (e.g. "Anti-pattern: X:::")
118+
md = md.replace(/^([^\n|#`>]+?):::(?!:)[^\S\n]*(.*)$/gm, (_, term, desc) =>
119+
desc.trim() ? `- **${term.trim()}**: ${desc.trim()}` : `- **${term.trim()}**`
120+
)
121+
122+
// Definition lists: term:: description → **term**: description
123+
// Non-greedy term match allows colons in term (e.g. "Anti-pattern: Ice cream cone::")
124+
md = md.replace(/^([^\n|#`>]+?)::[^\S\n]*(.*)$/gm, (_, term, desc) =>
125+
desc.trim() ? `**${term.trim()}**: ${desc.trim()}` : `**${term.trim()}**`
126+
)
127+
126128
// Bold: **text** stays, *text* → **text**
127129
md = md.replace(/(?<![*\w])\*([^*\n]+)\*(?![*\w])/g, '**$1**')
128130

website/public/llms.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ These terms are frequently used but **lack the depth and definition** required f
9292
| **"Keep it short"** | Pure directive with no conceptual depth. It's an instruction, not a methodology. |
9393
| **"Best practices"** | Too vague and not attributable. Whose best practices? Based on what research or authority? |
9494
| **"Modern approach"** | Ambiguous and inconsistent. "Modern" means different things to different people and changes over time. |
95-
| **"Make it simple"** | No reference to specific simplification frameworks (unlike KISS principle or Occam's Razor which **are** semantic anchors). |### Comparison: Good vs. Bad
95+
| **"Make it simple"** | No reference to specific simplification frameworks (unlike KISS principle or Occam's Razor which **are** semantic anchors). |
96+
97+
### Comparison: Good vs. Bad
9698

9799
**Example 1: Testing Instructions**
98100

@@ -1895,7 +1897,7 @@ Filter by constraints (e.g., "AsciiDoc + Hugo not well-supported")
18951897

18961898
**Nelson Rules**: 8 rules for pattern recognition on Control Charts
18971899

1898-
SPC:: Control Charts are the central tool of Statistical Process Control
1900+
**SPC**: Control Charts are the central tool of Statistical Process Control
18991901

19001902
**Six Sigma**: Control Charts are used in the Control phase of DMAIC
19011903

@@ -1942,7 +1944,7 @@ SPC:: Control Charts are the central tool of Statistical Process Control
19421944

19431945
**Control Chart (Shewhart)**: Nelson Rules are applied to Control Charts
19441946

1945-
SPC:: Nelson Rules are a tool within Statistical Process Control
1947+
**SPC**: Nelson Rules are a tool within Statistical Process Control
19461948

19471949
**Western Electric Rules**: Predecessor; Nelson Rules extend these with Rules 5-8
19481950

@@ -2395,7 +2397,7 @@ SPC:: Nelson Rules are a tool within Statistical Process Control
23952397

23962398
**Feedback loops**: Faster feedback from lower levels
23972399

2398-
Anti-pattern: Ice cream cone:: Too many E2E tests, too few unit tests
2400+
**Anti-pattern: Ice cream cone**: Too many E2E tests, too few unit tests
23992401

24002402
**Test at the right level**: Don't test through UI what can be tested in isolation
24012403

0 commit comments

Comments
 (0)