From 8349ef42dbf1bd299f778211c66795509c775c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Pe=CC=81rez?= Date: Wed, 14 Jan 2026 05:13:47 +0000 Subject: [PATCH] chore: fix fences errors --- docs/README.md | 4 +--- scripts/fix-markdown-fences.nu | 40 ++++++---------------------------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/docs/README.md b/docs/README.md index ef9aad5..24f3ec8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -77,14 +77,12 @@ If you prefer a formatted HTML website with search, themes, and copy buttons, bu ### Prerequisites ```bash -bash cargo install mdbook ``` ### Build & Serve ```bash -bash # Navigate to docs directory cd provisioning/docs @@ -137,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). \ No newline at end of file diff --git a/scripts/fix-markdown-fences.nu b/scripts/fix-markdown-fences.nu index db102b7..9eb275d 100755 --- a/scripts/fix-markdown-fences.nu +++ b/scripts/fix-markdown-fences.nu @@ -147,41 +147,15 @@ def fix-literal-newlines [content] { } } -# Clean up corrupted {$detected_lang} literals and remnant text lines +# Clean up corrupted {$detected_lang} literals only (preserve structure and blanks) def cleanup-corrupted-fences [content] { - let lines = $content | lines - mut fixed_lines = [] - mut fixed_count = 0 - - for idx in (0..<($lines | length)) { - let line = $lines | get $idx - - # Check for corrupted opening fence with {$detected_lang} - if ($line =~ '^```\{?\$detected_lang\}?$') { - # Replace with clean ``` - $fixed_lines = ($fixed_lines | append '```') - $fixed_count += 1 - } else { - # Check if this is a remnant "text" line after a language-tagged opening fence - let is_text_remnant = ( - $idx > 0 and - ($lines | get ($idx - 1)) =~ '^```\w+' and - $line == 'text' - ) - - if $is_text_remnant { - # Skip this garbage line - $fixed_count += 1 - } else { - # Keep the line - $fixed_lines = ($fixed_lines | append $line) - } - } - } - + # Only fix corrupted opening fences with {$detected_lang} + # Replace them with clean ``` (without language tag so they can be detected later) { - content: ($fixed_lines | str join "\n") - fixed_count: $fixed_count + content: ($content | str replace -a '```{$detected_lang}' '```') + fixed_count: ( + $content | str collect | if ($content | str contains '```{$detected_lang}') { 1 } else { 0 } + ) } }