@@ -12,7 +12,7 @@ import { coerce } from "semver/mod.ts";
1212import { kProjectType , ProjectContext } from "../project/types.ts" ;
1313import { isSubdir } from "fs/_util.ts" ;
1414
15- import { dirname , join , normalize , relative } from "path/mod.ts" ;
15+ import { dirname , isAbsolute , join , normalize , relative } from "path/mod.ts" ;
1616import { Metadata , QuartoFilter } from "../config/types.ts" ;
1717import { resolvePathGlobs } from "../core/path.ts" ;
1818import { toInputRelativePaths } from "../project/project-shared.ts" ;
@@ -316,7 +316,7 @@ export function discoverExtensionPath(
316316 } `,
317317 ) ;
318318 }
319- return paths . include [ 0 ] ;
319+ return relative ( Deno . cwd ( ) , paths . include [ 0 ] ) ;
320320 } else {
321321 return undefined ;
322322 }
@@ -386,7 +386,10 @@ function readExtension(
386386
387387 // The directory containing this extension
388388 // Paths used should be considered relative to this dir
389- const extensionDir = dirname ( extensionFile ) ;
389+ const extensionDirRaw = dirname ( extensionFile ) ;
390+ const extensionDir = isAbsolute ( extensionDirRaw )
391+ ? extensionDirRaw
392+ : join ( Deno . cwd ( ) , extensionDirRaw ) ;
390393
391394 // The formats that are being contributed
392395 const formats = contributes ?. formats as Metadata ||
@@ -436,7 +439,7 @@ function readExtension(
436439 id : extensionId ,
437440 path : extensionDir ,
438441 contributes : {
439- shortcodes : shortcodes . map ( ( code ) => join ( extensionDir , code ) ) ,
442+ shortcodes,
440443 filters,
441444 formats,
442445 } ,
@@ -464,7 +467,7 @@ function resolveShortcode(
464467 const shortcodes : string [ ] = [ ] ;
465468 for ( const shortcode of extensions [ 0 ] . contributes . shortcodes || [ ] ) {
466469 // Shortcodes are expected to be extension relative paths
467- shortcodes . push ( relative ( dir , shortcode ) ) ;
470+ shortcodes . push ( relative ( dir , join ( extensions [ 0 ] . path , shortcode ) ) ) ;
468471 }
469472 return shortcodes ;
470473 } else {
@@ -493,7 +496,15 @@ function resolveFilter(
493496 if ( extensions . length > 0 ) {
494497 const filters : QuartoFilter [ ] = [ ] ;
495498 for ( const filter of extensions [ 0 ] . contributes . filters || [ ] ) {
496- filters . push ( filter ) ;
499+ // Filters are expected to be extension relative paths
500+ if ( typeof ( filter ) === "string" ) {
501+ filters . push ( relative ( dir , join ( extensions [ 0 ] . path , filter ) ) ) ;
502+ } else {
503+ filters . push ( {
504+ type : filter . type ,
505+ path : relative ( dir , join ( extensions [ 0 ] . path , filter . path ) ) ,
506+ } ) ;
507+ }
497508 }
498509 return filters ;
499510 } else {
0 commit comments