pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.35k stars 101 forks source link

How to limit mdsvex to a certain subfolder (and file extension) #241

Closed zeckon closed 3 years ago

zeckon commented 3 years ago

Hello, I have a question regarding mdsvex,

I am planning to use mdsvex for named layouts (mostly a default _ layout) for all my routes (pages) in svelte-kit,

:heavy_check_mark: if there is no layout defined in frontmatter, it loads /src/layouts/default.svelte :heavy_check_mark: if there is a layout defined, it loads that from /src/layout/something.svelte ❌ if i set mdsvex extension to .svelte instead of .svx in config, it also tries to set a layout for /src/layouts/default.svelte and causes a circular dependency error and fails Circular dependency: .svelte/dev/generated/root.svelte -> /src/layouts/default.svelte -> /src/layouts/default.svelte

➕ also i don't want to have default layouts for files in /src/lib or /src/something with .svelte extensions

my question is how to limit mdsvex processing only to /src/routes/*.svelte (so it doesn't process other folders)

Thank you very much for your help.

zeckon commented 3 years ago

I also tried --- layout: false --- on /src/layouts/default.svelte

this solves circular dependency issue, but all components and $layouts require it as well to prevent default layout to be included

zeckon commented 3 years ago

After a second thought, keeping a distinct extension other than .svelte may have other benefits. i couldn't come up with another use-case for targeting only a sub folder, so i am closing this, thank you