pngwn / MDsveX

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

rehype-code-titles & rehype-prism-plus not support #534

Closed leokolt closed 1 year ago

leokolt commented 1 year ago

Hi. I noticed that the plugins rehype-code-titles and rehype-prism-plus do not work. Below is the code of how I added the configuration. rehype-code-titles should add the name of the code block via this syntax ```ts:src/pages/index.js but instead, he just writes in the code that this is such a language ts:src/pages/index.js. rehype-prism-plus adds the ability to use line numbering and highlight multiple lines indicating the added or deleted code.


//svelte.config.ts
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';

import { mdsvex } from 'mdsvex'

import rehypePrism from 'rehype-prism-plus'
import rehypeCodeTitles from 'rehype-code-titles'
import rehypeSlug from 'rehype-slug'

/** @type {import('mdsvex').MdsvexOptions} */
const mdsvexOptions = {
    extensions: ['.md'],
    rehypePlugins: [
        rehypeCodeTitles,
        rehypePrism,
        rehypeSlug
      ]
}

/** @type {import('@sveltejs/kit').Config} */
const config = {
    // Consult https://kit.svelte.dev/docs/integrations#preprocessors
    // for more information about preprocessors
    extensions: ['.svelte', '.md'],
    preprocess: [vitePreprocess(), mdsvex(mdsvexOptions)],

    kit: {
        // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
        // If your environment is not supported or you settled on a specific environment, switch out the adapter.
        // See https://kit.svelte.dev/docs/adapters for more information about adapters.
        adapter: adapter()
    }
};

export default config;
leokolt commented 1 year ago

silence

iansamz commented 1 year ago

Same issue here

lubiah commented 1 year ago

I think I know the problem