pngwn / MDsveX

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

Using multiple layouts seem to result in no layout being used #50

Closed kevmodrome closed 4 years ago

kevmodrome commented 4 years ago

Version: 0.5.1 beta 0 it looks like this works:

mdsvex({
  layout: "./src/layouts/Test.svelte"
})

But this does not:

mdsvex({
    layouts: {
        test: "./src/layouts/Test.svelte",
        _: "./src/layouts/Test.svelte"
    }
});

The latter seems to result in no layout being used at all. Adding layout: test to the mdsvex file does not seem to help either.

pngwn commented 4 years ago

This is a documentation issue, both should be called layout. I'll also add a warning when layouts is used as an option instead of layout. TS types will help here also.

joshpoll commented 4 years ago

I'd like to bump this issue! I followed the online docs, which still mentions layouts. The code fails silently, so this was really hard to track down.

pngwn commented 4 years ago

This should be properly documented now, and mdsvex will throw an error with a helpful message when passing layouts as an option. Additionally, you will get a warning in the console whenever unknown options are passed along with a list of valid options.

I hope to further improve error handling when I get around to thinking about it properly.