Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdsvex tries to evaluate code blocks in markdown :| #481

Closed
babakfp opened this issue Nov 1, 2022 · 2 comments
Closed

mdsvex tries to evaluate code blocks in markdown :| #481

babakfp opened this issue Nov 1, 2022 · 2 comments

Comments

@babakfp
Copy link

babakfp commented Nov 1, 2022

Example code block in markdown:

```svelte

<script> let tag = 'div' let element </script>

<svelte:element
this={tag}
bind:this={element}

...
</svelte:element>
```

I use the same example from the docs to change the syntax highlighter:

function highlighter(code, lang) {
	return `<pre><code>${code}</code></pre>`
}

error:

[vite] Internal server error: C:/Users/babak/Desktop/babakfp/src/lib/content/blog/make-svelte-bet/content/blog/make-svelte-better/_lib/dynamic-html-tags.md:20:12 element is not declared
  Plugin: vite-plugin-svelte                                                   _lib/dynamic-html-tags.md    
  File: C:/Users/babak/Desktop/babakfp/src/lib/content/blog/make-svelte-better/_lib/dynamic-html-tags.md
   18 |  <svelte:element
   19 |    this={tag}
   20 |    bind:this={element}
                      ^
   21 |  >
   22 |    ...
@babakfp
Copy link
Author

babakfp commented Nov 1, 2022

I think it's because of Svelte, it tries to run the code and mdsvex is unable to stop it. Because when I remove mdsvex from the preprocess config, the same thing happens.

@babakfp
Copy link
Author

babakfp commented Nov 2, 2022

#234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant