Solid-start + mdx: remark-shiki-twoslash does not work

I tried the current version of solid-start with mdx and attempted to integrate remark-shiki-twoslash (same as the docs), but no luck so far. I do not see syntax highlighting.
1 Reply
Alex Lohr
Alex Lohr5mo ago
I used the same configuration that is exported in solid-start-mdx (copy and pasted the return value, except for the other rehype/remark plugins except for rehypeRaw).
import { nodeTypes } from "@mdx-js/mdx";
import { defineConfig } from "@solidjs/start/config";
/* @ts-ignore */
import pkg from "@vinxi/plugin-mdx";
import rehypeRaw from "rehype-raw";
import { default as shikiTwoslash } from "remark-shiki-twoslash";

const { default: mdx } = pkg;
export default defineConfig({
start: {
ssr: true,
extensions: ["mdx", "md"],
server: { preset: "static" },
},
plugins: [
[mdx.withImports({})({
jsx: true,
jsxImportSource: "solid-js",
providerImportSource: "solid-mdx",
mdxOptions: {
rehypePlugins: [[rehypeRaw, { passThrough: nodeTypes }]],
remarkPlugins: [
[
shikiTwoslash,
{
disableImplicitReactImport: true,
includeJSDocInHover: true,
theme: "css-variables",
defaultCompilerOptions: {
allowSyntheticDefaultImports: true,
esModuleInterop: true,
target: "ESNext",
module: "ESNext",
lib: ["lib.dom.d.ts", "lib.es2015.d.ts"],
jsxImportSource: "solid-js",
jsx: "preserve",
types: ["vite/client"],
paths: {
"~/*": ["./src/*"],
},
},
},
],
],
},
})],
],
});
import { nodeTypes } from "@mdx-js/mdx";
import { defineConfig } from "@solidjs/start/config";
/* @ts-ignore */
import pkg from "@vinxi/plugin-mdx";
import rehypeRaw from "rehype-raw";
import { default as shikiTwoslash } from "remark-shiki-twoslash";

const { default: mdx } = pkg;
export default defineConfig({
start: {
ssr: true,
extensions: ["mdx", "md"],
server: { preset: "static" },
},
plugins: [
[mdx.withImports({})({
jsx: true,
jsxImportSource: "solid-js",
providerImportSource: "solid-mdx",
mdxOptions: {
rehypePlugins: [[rehypeRaw, { passThrough: nodeTypes }]],
remarkPlugins: [
[
shikiTwoslash,
{
disableImplicitReactImport: true,
includeJSDocInHover: true,
theme: "css-variables",
defaultCompilerOptions: {
allowSyntheticDefaultImports: true,
esModuleInterop: true,
target: "ESNext",
module: "ESNext",
lib: ["lib.dom.d.ts", "lib.es2015.d.ts"],
jsxImportSource: "solid-js",
jsx: "preserve",
types: ["vite/client"],
paths: {
"~/*": ["./src/*"],
},
},
},
],
],
},
})],
],
});
I even updated to the newest versions of everything. Updated solid-start again, still doesn't work. console output in the mdx plugin is suppressed, how do you debug it? I found the solution: remarkPlugins/rehashPlugins need to be a level above mdxOptions!
Want results from more Discord servers?
Add your server
More Posts
How props.children get informed in router.jsx value change ? eg: logined =true,children refresh```jsx //app.jsx const App = (props) => { const [logined, setLogined] = createSignal(false); retError while using useNavigate() or <Navigate />PrivateRoute.tsx ` import { Route, useNavigate } from '@solidjs/router' import Index from '../pagesLowercase propsWhat is point of lowercase props "tabIndex" vs "tabindex", "onClick" vs "onclick" and etc?Good library for handling combobox-style search UI? (with Pagefind)I'm trying to create an Algolia-style interface with [Pagefind](https://pagefind.app)'s search API, Which Solidjs Router library should we useThere are different libraries for SolidJs Router in different documentations earlier it was " solid-Router with hash integration or hash Router in SolidJSHow to setup has Router or Router with hash integration in new version of SolidJS Router!“use server”; Is Breaking Everything In My AppI’ve got one post going that touches on this subject of “use server”; breaking my app: [A New Way toHelp with Transitions (solid-transition-group)Can someone help me debug why this is not animating? ``` import { createSignal, Show } from 'solid-Failed to build with Vite plugin and Vercel adapter.Hi all, I'm trying to deploy my app to Vercel. I've had no luck so far (I can see the project files Help with some JSX logic in Typescript on an Advanced Resizing ComponentI am working on making a custom resizing component wrapper for my app. I have the resizing logic all