Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

render markdown in nextjs

// Render Markdown in Next.JS + React:
import ReactMarkdown from 'react-markdown';

export default function ThePage() {
  const markdown = `## _The Last Markdown Editor, Ever_`;
  return <ReactMarkdown source = { markdown } />
}
Comment

nextjs markdown

// pages/index.js

import { MDXProvider } from '@mdx-js/react';
import Image from 'next/image';
import { Heading, Text, Pre, Code, Table } from '../components';

const ResponsiveImage = (props) => (
  <Image alt={props.alt} layout="responsive" {...props} />
);

const components = {
  img: ResponsiveImage,
  h1: Heading.H1,
  h2: Heading.H2,
  p: Text,
  code: Pre,
  inlineCode: Code,
};

export default function Post(props) {
  return (
    <MDXProvider components={components}>
      <main {...props} />
    </MDXProvider>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue 
Javascript :: ts base64 from file 
Javascript :: erc20 token api 
Javascript :: javascript infinity 
Javascript :: vue js props 
Javascript :: make indexOF in js 
Javascript :: firebase timestamp to date react 
Javascript :: canvas js in react 
Javascript :: tinymce for react 
Javascript :: angular input decimal pipe 
Javascript :: destructuring an array 
Javascript :: Array of indexOf 
Javascript :: Javascript first example 
Javascript :: python json loads single quotes 
Javascript :: node js file extension 
Javascript :: display none after hover 
Javascript :: define function js 
Javascript :: working with multiple db in single query mongodb 
Javascript :: async await map 
Javascript :: destructuring javascript 
Javascript :: add property with value in js 
Javascript :: pure component in react 
Javascript :: how to usestate in react 
Javascript :: how to generate a random number between certain values 
Javascript :: js button to take current page screenshot 
Javascript :: frame-grab js 
Javascript :: code for random dom background image change 
Javascript :: select all child elements javascript 
Javascript :: javascript generator send vs next 
Javascript :: react algoliasearch 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =