Cannot use custom (preprocessed) syntax in mdsvex files
See original GitHub issueI tried to use SCSS in my layout svelte file and it gave me the error:
(node:14140) UnhandledPromiseRejectionWarning: ParseError: Colon is expected
at error$1 (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\svelte\compiler.js:15595:20)
at Parser$1.error (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\svelte\compiler.js:15671:10)
at Object.read_style [as read] (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\svelte\compiler.js:11997:21)
at tag (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\svelte\compiler.js:14737:34)
at new Parser$1 (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\svelte\compiler.js:15630:22)
at Object.parse$3 [as parse] (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\svelte\compiler.js:15761:21)
at process_layouts (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\mdsvex\dist\main.cjs.js:25708:26)
at Object.mdsvex (D:\Mudit and Harshit\Projects\svelte-materialify\site\node_modules\mdsvex\dist\main.cjs.js:25799:12)
at Object.<anonymous> (D:\Mudit and Harshit\Projects\svelte-materialify\site\rollup.config.js:32:10)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
But when I removed the lang
attribute from my style
tag and used CSS instead of SCSS, it showed no errors and worked fine.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
mdsvex docs!
The preprocessor function accepts an object of options, that allow you to customise your experience. The options are global to all parsed files....
Read more >svelte-exmarkdown - npm
You cannot use custom syntax(e.g. KaTeX). MDsveX is another good package. However, it is a preprocessor. Not suitable for dynamic rendering.
Read more >svelte-exmarkdown - NPM Package Overview - Socket.dev
You cannot use custom syntax(e.g. KaTeX). MDsveX is another good package. However, it is a preprocessor. Not suitable for dynamic rendering.
Read more >MDsveX - Adding Interactivity with Svelte Components in ...
This preprocessor allows you to use Svelte components in your markdown, ... be saved in a .svx file to be recognized as a...
Read more >Recently Active 'remarkjs' Questions - Stack Overflow
I'm in svelte with the mdsvex package so I can easily use remark or rehype plugins. Say, next to my markdown file I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I hit an error while trying to use typescript in my layout files like this:
A rather simple workaround to this that seems to do the job well, is to wrap your actual Layout in another “plain” svelte component, that only passes down frontmatter props. Apprently whatever is imported into layout file is still correctly preprocessed. E.g.:
The above will work just fine even if
Layout.svelte
is written in typescript or needs other preprocessors.