chore: fix fences errors

This commit is contained in:
Jesús Pérez 2026-01-14 05:13:47 +00:00
parent 2d442bcbde
commit 8349ef42db
Signed by: jesus
GPG Key ID: 9F243E355E0BC939
2 changed files with 8 additions and 36 deletions

View File

@ -77,14 +77,12 @@ If you prefer a formatted HTML website with search, themes, and copy buttons, bu
### Prerequisites ### Prerequisites
```bash ```bash
bash
cargo install mdbook cargo install mdbook
``` ```
### Build & Serve ### Build & Serve
```bash ```bash
bash
# Navigate to docs directory # Navigate to docs directory
cd provisioning/docs cd provisioning/docs

View File

@ -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] { def cleanup-corrupted-fences [content] {
let lines = $content | lines # Only fix corrupted opening fences with {$detected_lang}
mut fixed_lines = [] # Replace them with clean ``` (without language tag so they can be detected later)
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)
}
}
}
{ {
content: ($fixed_lines | str join "\n") content: ($content | str replace -a '```{$detected_lang}' '```')
fixed_count: $fixed_count fixed_count: (
$content | str collect | if ($content | str contains '```{$detected_lang}') { 1 } else { 0 }
)
} }
} }