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