mirror of
https://github.com/pheralb/svgl.git
synced 2024-12-05 05:42:35 +08:00
🔧 Add custom markdown plugins
This commit is contained in:
parent
8f4ac1406f
commit
56597ef7ce
@ -7,11 +7,31 @@ import adapter from '@sveltejs/adapter-node';
|
||||
import { mdsvex, escapeSvelte } from 'mdsvex';
|
||||
import { createHighlighter, makeSingletonHighlighter } from 'shiki';
|
||||
|
||||
// 🎨 Markdown Plugins:
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
||||
import rehypeSlug from 'rehype-slug';
|
||||
|
||||
// 📄 Markdown config:
|
||||
const getHighlighter = makeSingletonHighlighter(createHighlighter);
|
||||
|
||||
/** @type {import('mdsvex').MdsvexOptions} */
|
||||
const mdsvexOptions = {
|
||||
remarkPlugins: [[remarkGfm]],
|
||||
rehypePlugins: [
|
||||
[rehypeSlug],
|
||||
[
|
||||
rehypeAutolinkHeadings,
|
||||
{
|
||||
behavior: 'wrap',
|
||||
properties: {
|
||||
className: [
|
||||
`before:content-['#'] before:absolute before:-ml-[1em] before:text-neutral-100/0 hover:before:text-neutral-200/50 pl-[1em] -ml-[1em]`
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
extensions: ['.md'],
|
||||
highlight: {
|
||||
highlighter: async (code, lang = 'text') => {
|
||||
|
Loading…
Reference in New Issue
Block a user