Skip to content

Commit d11bc7a

Browse files
committed
fix: replace_secion
1 parent 2ec96c6 commit d11bc7a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docs/codegen/src/utils.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ pub(crate) fn replace_section(
1212
section_identifier, section_identifier
1313
);
1414
let re = Regex::new(&pattern).unwrap();
15-
re.replace_all(content, format!("${{1}}{}${{2}}", replacement))
16-
.to_string()
15+
16+
// Use a replacement function instead of a replacement string to avoid
17+
// issues with special characters like $ in the replacement text
18+
re.replace_all(content, |caps: &regex::Captures| {
19+
format!("{}{}{}", &caps[1], replacement, &caps[2])
20+
})
21+
.to_string()
1722
}
1823

1924
#[derive(Default)]

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ After running the `init` command, you’ll have a `pglt.jsonc` file in your dire
4141

4242
```json
4343
{
44-
"": "https://supabase-community.github.io/postgres_lsp/schemas/0.0.0/schema.json",
44+
"$schema": "https://supabase-community.github.io/postgres_lsp/schemas/0.0.0/schema.json",
4545
"vcs": {
4646
"enabled": false,
4747
"clientKind": "git",

0 commit comments

Comments
 (0)