chore: fix fences errors
This commit is contained in:
parent
59eea6d232
commit
ceffb434fe
@ -135,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).
|
||||||
|
|||||||
@ -68,7 +68,7 @@ def main [
|
|||||||
|
|
||||||
# Phase 0: Fix literal \n escape sequences (Nushell - SAFE)
|
# Phase 0: Fix literal \n escape sequences (Nushell - SAFE)
|
||||||
if ($phase == "newlines" or $phase == "all") {
|
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
|
let newlines_result = fix-literal-newlines $modified_content
|
||||||
$newlines_fixed = $newlines_result.fixed_count
|
$newlines_fixed = $newlines_result.fixed_count
|
||||||
$total_newlines_fixed += $newlines_fixed
|
$total_newlines_fixed += $newlines_fixed
|
||||||
@ -142,20 +142,18 @@ def main [
|
|||||||
# Fix literal \n escape sequences → actual newlines
|
# Fix literal \n escape sequences → actual newlines
|
||||||
def fix-literal-newlines [content] {
|
def fix-literal-newlines [content] {
|
||||||
{
|
{
|
||||||
content: ($content | str replace -a '\\n' "\n")
|
content: ($content | str replace -a '\n' "\n")
|
||||||
fixed_count: 1
|
fixed_count: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up corrupted {$detected_lang} literals only (preserve structure and blanks)
|
# Clean up corrupted {$detected_lang} literals only (preserve structure and blanks)
|
||||||
def cleanup-corrupted-fences [content] {
|
def cleanup-corrupted-fences [content] {
|
||||||
# Only fix corrupted opening fences with {$detected_lang}
|
let had_corruption = $content | str contains '```{$detected_lang}'
|
||||||
# Replace them with clean ``` (without language tag so they can be detected later)
|
let fixed_content = $content | str replace -a '```{$detected_lang}' '```'
|
||||||
{
|
{
|
||||||
content: ($content | str replace -a '```{$detected_lang}' '```')
|
content: $fixed_content
|
||||||
fixed_count: (
|
fixed_count: (if $had_corruption { 1 } else { 0 })
|
||||||
$content | str collect | if ($content | str contains '```{$detected_lang}') { 1 } else { 0 }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user