diff --git a/.changeset/light-bikes-battle.md b/.changeset/light-bikes-battle.md new file mode 100644 index 00000000..ccf14bb1 --- /dev/null +++ b/.changeset/light-bikes-battle.md @@ -0,0 +1,5 @@ +--- +'mdsvex': patch +--- + +Allow more extensive extension filtering. For example, now `.md.svelte` is possible diff --git a/packages/mdsvex/src/index.ts b/packages/mdsvex/src/index.ts index cc11dbd0..2657914e 100644 --- a/packages/mdsvex/src/index.ts +++ b/packages/mdsvex/src/index.ts @@ -286,10 +286,8 @@ export const mdsvex = (options: MdsvexOptions = defaults): Preprocessor => { return { name: 'mdsvex', markup: async ({ content, filename }) => { - const extensionsParts = (extensions || [extension]).map((ext) => - ext.split('.').pop() - ); - if (!extensionsParts.includes(filename.split('.').pop())) return; + const extensionsParts = (extensions || [extension]).map(ext => ext.startsWith('.') ? ext : '.' + ext); + if (!extensionsParts.some(ext => filename.endsWith(ext))) return; const parsed = await parser.process({ contents: content, filename }); return {