diff --git a/docs/README.md b/docs/README.md index 24f3ec8..313fd9d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -135,4 +135,4 @@ All documentation is standard GitHub Flavored Markdown. You can: - **Looking for API docs** → See [API Reference](src/api-reference/) - **Want architecture details** → Read [Architecture Overview](src/architecture/architecture-overview.md) -For complete navigation, see [Table of Contents](src/SUMMARY.md). \ No newline at end of file +For complete navigation, see [Table of Contents](src/SUMMARY.md). diff --git a/scripts/fix-markdown-fences.nu b/scripts/fix-markdown-fences.nu index 9eb275d..e10be4f 100755 --- a/scripts/fix-markdown-fences.nu +++ b/scripts/fix-markdown-fences.nu @@ -68,7 +68,7 @@ def main [ # Phase 0: Fix literal \n escape sequences (Nushell - SAFE) if ($phase == "newlines" or $phase == "all") { - if ($modified_content | str contains '\\n') { + if ($modified_content | str contains '\n') { let newlines_result = fix-literal-newlines $modified_content $newlines_fixed = $newlines_result.fixed_count $total_newlines_fixed += $newlines_fixed @@ -142,20 +142,18 @@ def main [ # Fix literal \n escape sequences → actual newlines def fix-literal-newlines [content] { { - content: ($content | str replace -a '\\n' "\n") + content: ($content | str replace -a '\n' "\n") fixed_count: 1 } } # Clean up corrupted {$detected_lang} literals only (preserve structure and blanks) def cleanup-corrupted-fences [content] { - # Only fix corrupted opening fences with {$detected_lang} - # Replace them with clean ``` (without language tag so they can be detected later) + let had_corruption = $content | str contains '```{$detected_lang}' + let fixed_content = $content | str replace -a '```{$detected_lang}' '```' { - content: ($content | str replace -a '```{$detected_lang}' '```') - fixed_count: ( - $content | str collect | if ($content | str contains '```{$detected_lang}') { 1 } else { 0 } - ) + content: $fixed_content + fixed_count: (if $had_corruption { 1 } else { 0 }) } }