chore: fix fences errors

This commit is contained in:
Jesús Pérez 2026-01-14 05:26:18 +00:00
parent 59eea6d232
commit ceffb434fe
Signed by: jesus
GPG Key ID: 9F243E355E0BC939
2 changed files with 7 additions and 9 deletions

View File

@ -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).
For complete navigation, see [Table of Contents](src/SUMMARY.md).

View File

@ -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 })
}
}