Have pi format most markdown files on save
Avoiding skills as they can contain generated blocks
This commit is contained in:
@@ -9,6 +9,16 @@ function isPiTsFile(path: string, cwd: string): boolean {
|
||||
return resolve(cwd, path).startsWith(piDir);
|
||||
}
|
||||
|
||||
function isDocsMd(path: string): boolean {
|
||||
// Matches docs/*.md — only direct children, not nested
|
||||
return /^docs\/[^/]+\.md$/.test(path);
|
||||
}
|
||||
|
||||
function isBacklogMd(path: string): boolean {
|
||||
// Matches backlog/**/*.md — any depth under backlog/
|
||||
return /^backlog\/.+\.md$/.test(path);
|
||||
}
|
||||
|
||||
async function formatElixir(
|
||||
pi: ExtensionAPI,
|
||||
path: string,
|
||||
@@ -42,6 +52,12 @@ export default function (pi: ExtensionAPI) {
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
} else if (isDocsMd(path) || isBacklogMd(path)) {
|
||||
try {
|
||||
await formatTypeScript(pi, path, ctx.signal);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
} else if (isPiTsFile(path, ctx.cwd)) {
|
||||
try {
|
||||
await formatTypeScript(pi, path, ctx.signal);
|
||||
|
||||
Reference in New Issue
Block a user