chore: fix fences errors
This commit is contained in:
parent
2d442bcbde
commit
8349ef42db
@ -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
|
||||||
|
|
||||||
@ -137,4 +135,4 @@ All documentation is standard GitHub Flavored Markdown. You can:
|
|||||||
- **Looking for API docs** → See [API Reference](src/api-reference/)
|
- **Looking for API docs** → See [API Reference](src/api-reference/)
|
||||||
- **Want architecture details** → Read [Architecture Overview](src/architecture/architecture-overview.md)
|
- **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).
|
||||||
@ -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 }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user