@@ -851,19 +851,28 @@ async function resolveFilterExtension(
851851 // Resolve any filters that are provided by an extension
852852 const results : ( QuartoFilter | QuartoFilter [ ] ) [ ] = [ ] ;
853853 const getFilter = async ( filter : QuartoFilter ) => {
854- // Look for extension names in the filter list and result them
854+ // Look for extension names in the filter list and resolve them
855855 // into the filters provided by the extension
856- if (
857- filter !== kQuartoFilterMarker && filter !== kQuartoCiteProcMarker &&
858- typeof filter === "string"
859- ) {
856+ if ( filter === kQuartoFilterMarker || filter === kQuartoCiteProcMarker ) {
857+ return filter ;
858+ }
859+
860+ let pathToResolve : string | null = null ;
861+
862+ if ( typeof filter === "string" ) {
863+ pathToResolve = filter ;
864+ } else if ( typeof filter === "object" && filter . path ) {
865+ pathToResolve = filter . path ;
866+ }
867+
868+ if ( pathToResolve ) {
860869 // The filter string points to an executable file which exists
861- if ( existsSync ( filter ) && ! Deno . statSync ( filter ) . isDirectory ) {
870+ if ( existsSync ( pathToResolve ) && ! Deno . statSync ( pathToResolve ) . isDirectory ) {
862871 return filter ;
863872 }
864873
865874 const extensions = await options . services . extension ?. find (
866- filter ,
875+ pathToResolve ,
867876 options . source ,
868877 "filters" ,
869878 options . project ?. config ,
@@ -873,15 +882,35 @@ async function resolveFilterExtension(
873882 // Filter this list of extensions
874883 const filteredExtensions = filterExtensions (
875884 extensions || [ ] ,
876- filter ,
885+ pathToResolve ,
877886 "filter" ,
878887 ) ;
879888 // Return any contributed plugins
880889 if ( filteredExtensions . length > 0 ) {
881890 // This matches an extension, use the contributed filters
882- const filters = extensions [ 0 ] . contributes . filters ;
883- if ( filters ) {
884- return filters ;
891+ const extensionFilters = extensions [ 0 ] . contributes . filters ;
892+ if ( extensionFilters ) {
893+ // After "path" resolution, "at" needs to be preserved
894+ if ( typeof filter === "string" ) {
895+ return extensionFilters ;
896+ } else if ( isFilterEntryPoint ( filter ) ) {
897+ return extensionFilters . map ( extFilter => {
898+ if ( typeof extFilter === "string" ) {
899+ return {
900+ type : extFilter . endsWith ( ".lua" ) ? "lua" : "json" as "lua" | "json" ,
901+ path : extFilter ,
902+ at : filter . at
903+ } ;
904+ } else {
905+ return {
906+ ...extFilter ,
907+ at : filter . at
908+ } ;
909+ }
910+ } ) ;
911+ } else {
912+ return extensionFilters ;
913+ }
885914 } else {
886915 return filter ;
887916 }
0 commit comments