1
0
Fork 0

feat(fs.dev): Added OG intro for description

This commit is contained in:
Joost De Cock 2021-12-28 20:01:59 +01:00
parent d71a8246ac
commit b59c5036ed
8 changed files with 51 additions and 150 deletions

View file

@ -9,6 +9,7 @@ import { compile } from '@mdx-js/mdx'
import remarkFrontmatter from 'remark-frontmatter'
import remarkGfm from 'remark-gfm'
import remarkCopyLinkedFiles from 'remark-copy-linked-files'
import { remarkIntroPlugin } from './remark-intro-plugin.mjs'
// Rehype plugins we want to use
import rehypeHighlight from 'rehype-highlight'
@ -29,6 +30,7 @@ const mdxLoader = async (language, site, slug) => {
path.resolve(`../../markdown/${site}/${slug}/${language}.md`),
'utf-8'
)
const intro = []
const mdx = String(
await compile(md, {
outputFormat: 'function-body',
@ -42,6 +44,10 @@ const mdxLoader = async (language, site, slug) => {
sourceDir: path.resolve(`../../markdown/${site}/${slug}`),
staticPath: '/mdx/',
}
],
[
remarkIntroPlugin,
{ intro }
]
],
rehypePlugins: [
@ -50,7 +56,7 @@ const mdxLoader = async (language, site, slug) => {
})
)
return mdx
return {mdx, intro}
}
export default mdxLoader