You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
npx sv create
┌ Welcome to the Svelte CLI! (v0.6.10)
│
◇ Where would you like your project to be created?
│ mdsvex-test
│
◇ Which template would you like?
│ SvelteKit minimal
│
◇ Add type checking with Typescript?
│ Yes, using Javascript with JSDoc comments
│
◆ Project created
│
◇ What would you like to add to your project? (use arrow keys / space bar)
│ mdsvex
│
◇ Which package manager do you want to install dependencies with?
│ npm
│
◆ Successfully setup add-ons
│
◆ Successfully installed dependencies
Modify svelte.config.js to include .svelte and .svx files
import { mdsvex } from "mdsvex";
import adapter from '@sveltejs/adapter-auto';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
},
preprocess: [mdsvex({
+ extensions: [".svelte", ".svx"],
})],
extensions: [".svelte", ".svx"]
};
export default config;
Add some markdown to src/routes/+page.svelte
Observe error
[vite] Pre-transform error: .svelte-kit/generated/root.svelte:48:68 `</p>` attempted to close an element that was not open
https://svelte.dev/e/element_invalid_closing_tag
[vite] Error when evaluating SSR module /.svelte-kit/generated/root.js:
|-
[vite] Error when evaluating SSR module /.svelte-kit/generated/server/internal.js:
|-
[vite] Error when evaluating SSR module /node_modules/@sveltejs/kit/src/runtime/server/index.js:
Proposal
I'm not entirely sure how to solve this, but my assumptions are:
Adding the extensions property to the mdsvex call has already been discussed here: #186. Based on that issue it looks like people have different opinions on how they should name their svelte markdown files. Therefore, i would suggest we leave this for customization.
I'm able to reproduce the error you are getting though. Point 4 you mentioned is actually optional and not required to reproduce the error. Interestingly enough, renaming src/routes/+page.svelte to src/routes/+page.svx actually solves the error.
Problem
In a fresh project, mdsvex fails when markdown is used in
+page.svelte
files.Upstream issue: pngwn/MDsveX#685
Reproduction
npx sv create
svelte.config.js
to include.svelte
and.svx
filesimport { mdsvex } from "mdsvex"; import adapter from '@sveltejs/adapter-auto'; /** @type {import('@sveltejs/kit').Config} */ const config = { kit: { // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://svelte.dev/docs/kit/adapters for more information about adapters. adapter: adapter() }, preprocess: [mdsvex({ + extensions: [".svelte", ".svx"], })], extensions: [".svelte", ".svx"] }; export default config;
src/routes/+page.svelte
Proposal
I'm not entirely sure how to solve this, but my assumptions are:
.svelte
files causes error pngwn/MDsveX#685npx sv create
that add onmdsvex
have theirsvelte.config.js
include theextensions
option preconfigured.sv
template to use latestmdsvex
versionEnvironment
The text was updated successfully, but these errors were encountered: