import rehypePrism from '@mapbox/rehype-prism'
import nextMDX from '@next/mdx'
import remarkGfm from 'remark-gfm'

/** @type {import('next').NextConfig} */
const nextConfig = {
  pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
  redirects: async () => {
    return [
      {
        source: '/twitter',
        destination: 'https://twitter.com/thisisprad',
        permanent: true,
      },
      {
        source: '/github',
        destination: 'https://github.com/prnk28',
        permanent: true,
      },
      {
        source: '/linkedin',
        destination: 'https://www.linkedin.com/in/pradn/',
        permanent: true,
      },
      {
        source: '/medium',
        destination: 'https://medium.com/@prnk28',
        permanent: true,
      },
      {
        source: '/cal',
        destination: 'https://cal.com/pradn',
        permanent: true,
      },
    ]
  }
}

const withMDX = nextMDX({
  extension: /\.mdx?$/,
  options: {
    remarkPlugins: [remarkGfm],
    rehypePlugins: [rehypePrism],
  },
})

export default withMDX(nextConfig)
