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
```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).

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] {
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 }
)
}
}