mirror of
https://github.com/pheralb/svgl.git
synced 2024-11-15 01:31:57 +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 { mdsvex, escapeSvelte } from 'mdsvex';
|
||||||
import { createHighlighter, makeSingletonHighlighter } from 'shiki';
|
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:
|
// 📄 Markdown config:
|
||||||
const getHighlighter = makeSingletonHighlighter(createHighlighter);
|
const getHighlighter = makeSingletonHighlighter(createHighlighter);
|
||||||
|
|
||||||
/** @type {import('mdsvex').MdsvexOptions} */
|
/** @type {import('mdsvex').MdsvexOptions} */
|
||||||
const 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'],
|
extensions: ['.md'],
|
||||||
highlight: {
|
highlight: {
|
||||||
highlighter: async (code, lang = 'text') => {
|
highlighter: async (code, lang = 'text') => {
|
||||||
|
Loading…
Reference in New Issue
Block a user