add: dynamic instructions (#927)

This commit is contained in:
Fouad Matin
2025-05-14 01:27:46 -07:00
committed by GitHub
parent 1bf00a3a95
commit 678f0dbfec
3 changed files with 30 additions and 7 deletions

View File

@@ -325,14 +325,12 @@ function rewriteFileCitations(
fileOpener: FileOpenerScheme | undefined,
cwd: string = process.cwd(),
): string {
if (!fileOpener) {
// Should we reformat the citations even if we cannot linkify them?
return markdown;
}
citationRegex.lastIndex = 0;
return markdown.replace(citationRegex, (_match, file, start, _end) => {
const absPath = path.resolve(cwd, file);
if (!fileOpener) {
return `[${file}](${absPath})`;
}
const uri = `${fileOpener}://file${absPath}:${start}`;
const label = `${file}:${start}`;
// In practice, sometimes multiple citations for the same file, but with a