Skip to content

Commit

Permalink
loosen extension filtering to cover more possibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
vnphanquang authored and pngwn committed Jun 4, 2024
1 parent a6fc18e commit 1ff938c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-bikes-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mdsvex': patch
---

Allow more extensive extension filtering. For example, now `.md.svelte` is possible
6 changes: 2 additions & 4 deletions packages/mdsvex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1ff938c

Please sign in to comment.