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);
|
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(
|
async function formatElixir(
|
||||||
pi: ExtensionAPI,
|
pi: ExtensionAPI,
|
||||||
path: string,
|
path: string,
|
||||||
@@ -42,6 +52,12 @@ export default function (pi: ExtensionAPI) {
|
|||||||
} catch {
|
} catch {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
}
|
}
|
||||||
|
} else if (isDocsMd(path) || isBacklogMd(path)) {
|
||||||
|
try {
|
||||||
|
await formatTypeScript(pi, path, ctx.signal);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
} else if (isPiTsFile(path, ctx.cwd)) {
|
} else if (isPiTsFile(path, ctx.cwd)) {
|
||||||
try {
|
try {
|
||||||
await formatTypeScript(pi, path, ctx.signal);
|
await formatTypeScript(pi, path, ctx.signal);
|
||||||
|
|||||||
Reference in New Issue
Block a user