Questions tagged [mdxjs]

MDX is a flexible format that enables users to incorporate JSX directly into their markdown files.

Generating a File that Imports Components and Instantly Exports Them Once More

Having trouble with this code. Initially, I had: // file 1 import Box from '@/components/Box' import Popup from '@/components/Popup' const MDXComponents = { Box, Popup } // using MDXComponents somewhere in file 1 Now, to manage the growing size of t ...

Exploring the synergies of Remark and Rehype plugins alongside MDX in Next.js powered by @next/mdx

I’ve been experimenting with Github Flavored Markdown using @next/mdx, but I’m struggling to understand how to use plugins alongside the code. Here’s a breakdown of what I’ve attempted so far: (I’m following the instructions from the Next.js Doc ...

Set up a variety of next plugins including withMDX and withBundleAnalyzer

After initiating a nextjs site using a tailwind blog starter that comes with withBundleAnalyzer in my next.config.js, I am faced with the challenge of making .mdx files work directly from the pages. The documentation suggests adding withMDX to my nextjs.co ...

I am seeking guidance on how to properly display the html iframe element within rich text formatting

Currently, I am going through the Strapi tutorial that covers the process of creating a blog using Nextjs with Strapi. If you are interested, you can find the tutorial here One important point mentioned in the tutorial is that a markdown package needs to ...

The MDX blog was set up to showcase markdown content by simply displaying it without rendering, thanks to the utilization of the MDXProvider from @mdx-js/react within Next JS

I'm currently in the process of setting up a blog using MDX and Next.js, but I've encountered an issue with rendering Markdown content. The blog post seems to only display the markdown content as plain text instead of rendering it properly. If you'd like ...

Having trouble compiling MDX files that include React Components?

I have implemented NextJS and MDX using next-mdx-remote to retrieve my data, and it's working successfully. However, I encounter an error whenever I try to import React components: Error: Expected component CodeBlock to be defined: you likely forgot to i ...

Leveraging react-query with next-mdx-remote MDX Components?

I have been using next-mdx-remote in my next.js project. One of the components I've passed to it makes API calls using axios, which has been working well. However, I now want to switch to using react-query. When implementing this change, I encountered ...

Building custom MDX components with attribute-based data manipulation techniques

Can custom MDX components be defined using a data-attribute of the HTML element? Currently, I am developing a Next.js blog utilizing contentlayer for MDX and Rehype Pretty Code for syntax highlighting code blocks. The HTML output structure from Rehype Pre ...

Transform the code provided by bundleMDX into an HTML string specifically for RSS, all the while utilizing the mdx-bundler

I am currently working on developing an RSS reader and I need to convert the code returned by bundleMDX into a string. This is necessary so that I can utilize it with ReactDOMServer.renderToStaticMarkup(mdx) in my project. You can find a similar implement ...

Encountering a Hydration Error with Next.JS and MDX-Bundler when a MDX Component Adds Extra New Lines to its Children

Currently, I am incorporating next.js + mdx-bundler into my project. There is a simple component that I frequently use in my mdx files. Everything runs smoothly with the following code: Mdx is a great <Component>format and I like it a lot</Compon ...

Harness the power of MDX component props in Codehike Bright for seamless integration with Next.js

Currently, I am utilizing Codehike Bright alongside NextJS 13.2 in my app directory, which involves React Server Components integration. In addition to this setup, I am also incorporating MDX. Within the TSX file named page.tsx, the MDX content is loaded ...

Only pass props to `Image` if they have a defined value

As I construct a blog platform using MDX and NextJS, I am creating a custom image component that utilizes the Next <Image> component. However, I've encountered a minor issue for which I have been unable to find a solution. The main question is: In R ...

The process of integrating markdown markdown syntax into a React component using MDX

What is the most effective method to incorporate content from a markdown file foo.md into a component <Bar />? Will props need to be used for this? Can MDX handle such scenarios effectively? Your help is greatly appreciated! ...

Tips for including markdown content within components in MDX files

I'm currently in the process of utilizing MDX pages along with React components for a project. My issue lies in wanting to generate HTML when adding text inside a component, similar to how it works with content outside of components. However, I've noticed ...

The function onVisitHighlightedLine is unable to apply a classname when working with Rehype Pretty code

I have integrated Rehype Pretty code into my MDX blog to enhance syntax highlighting. However, I am encountering an issue with getting the line highlighting feature to function properly. After referring to the documentation and a few other sources, it see ...

The MDX syntax highlighting feature seems to be malfunctioning in Next.js

After importing the plugin @mapbox/rehype-prism, I noticed that syntax highlighting is not functioning as expected. //next.config.js const rehypePrism = require("@mapbox/rehype-prism"); const withMDX = require("@next/mdx")({ extens ...

What steps are involved in importing remark-gfm into next.config.js?

I am interested in incorporating MDX into next.js with the remark-gfm plugin. After discovering the Next.js Docs on MDX, I decided to follow their guidelines and added an import statement. // next.config.js import remarkGfm from 'remark-gfm;' const withMD ...

What are the best methods for combining MDX and STRAPI?

I am currently working on a project that involves incorporating MDX with Strapi. I'm a bit confused about how and where to integrate them, especially since MDX works with .mdx files while Strapi operates using APIs. If anyone has any insights or guid ...