Questions tagged [mdxjs]

MDX is an authorable format that lets users write JSX in markdown documents.

153 questions
3
votes
0 answers

Accessing React component state from MDX

Assume that I have the following files. import React, { useState } from 'react'; import someComputation from './someComputation'; type ComponentType = { input: number; }; const Component = (props: ComponentType) => { const [state, setState] =…
kemakino
  • 1,041
  • 13
  • 33
2
votes
0 answers

How can i find milkdown data?

I just setup milkdown for the first time and implement basic setup like see this examples: But now i can't find data (try console.log still not found). So how can i find data to use in my Project, can anyone help me out of this? #TIA Default data "#…
2
votes
0 answers

javascript inside storybook

So my file extension is .mdx and I'm not sure if it allows me to include js code inside the .mdx file. I tried having it in the preview tag but it prints it as a string. Below I have tried to write js code in a separate js file, import the function…
user12551649
  • 366
  • 5
  • 20
2
votes
1 answer

Formatting MDX programmatically using prettier

I would like to format MDX using prettier. It's working on the playground, but I'm having trouble to get it running programmatically. In my code i get an unchanged result (no error, but not formatted) Here is what i am doing: import prettier from…
dknaack
  • 60,192
  • 27
  • 155
  • 202
2
votes
0 answers

Next.js MDX blog post not building due to module not found, runs fine on localhost

My Next.js project is failing to build on Vercel. I have a BlogAuthor.tsx file as so: import Avatar from "../../Common/Avatar/Avatar"; import CopyLink from "../../Common/Widgets/CopyLink/CopyLink"; export default function BlogAuthor({ …
squish
  • 846
  • 12
  • 24
2
votes
1 answer

How to get data from the second query using a variable from the first query in graphql gatsby?

I'm trying to render all photos from a directory that will be defined in the frontmatter of an mdx file called carouselPhotosDir. I thought that to do this, I would need to query the specific mdx's carouselPhotosDir frontmatter field. Then, store…
2
votes
2 answers

Using Remark and Rehype plugins with MDX in Next.js (with @next/mdx)

I was trying to use Github Flavored Markdown using @next/mdx but I can't seem to figure out how to use plugins with the code. Here is what I did: (I am following along from Next.js Documentation:…
chadgamer3301
  • 23
  • 1
  • 4
2
votes
0 answers

Is there a way to set an image's size dynamically at build time with Next.js and next-mdx-remote blog posts?

I'm working on a personal blog using Next.js, Tailwind, and next-mdx-remote. I would like to be able to use the Next.js Image component for any images that appear in my posts, and I would like those images to take up the full width of the containing…
SkyPharaoh
  • 53
  • 4
2
votes
1 answer

Storybook mdx files are not displayed

I use default Storybook Webpack config alongside with data from my existed one. I don't see any *.mdx files in a stories side-bar. At first I just have replaced all config.module.rules by rules from existed webpack config and I got this error:…
radianth
  • 21
  • 1
  • 2
2
votes
0 answers

Docusaurus MDX - create links with a version variable

I'm using Docusaurus for building a documentation web-site for a project. The content is written as MDX files. Since the project has different versions I'd like to use links that contain the specific version. For example, for version 1.0 a link…
seladb
  • 852
  • 1
  • 13
  • 29
2
votes
2 answers

Error [ERR_REQUIRE_ESM]: require() of ES Module - Vue 3 Typescript

I am currently integrating mdx into my vue 3 typescript project. However, I get the following error when configuring the vue.config.js: yarn run v1.22.11 $ vue-cli-service serve ERROR Error loading…
Jannik Buscha
  • 658
  • 1
  • 9
  • 18
2
votes
0 answers

using tsx and mdx in storybook react

I am trying to achieve this: but with my stories broken down into mdx and tsx files. So far My mdx file looks like this: import { Meta, Story, Canvas, Preview, Props, ArgsTable } from '@storybook/addon-docs'; import { Button, Icons } from…
Alex Ironside
  • 4,658
  • 11
  • 59
  • 119
2
votes
1 answer

To calculate the average of Latest 12 weeks

I figured out how to calculate the average of latest 12 weeks volume in my data. But lets say the current year does not have 12 weeks, it only has 8 weeks then I want to take the remaining 4 weeks from the previous year to make it 12? This is how my…
2
votes
1 answer

Cannot import meta data from mdx file in getStaticProps nextjs

I have a problem while trying to require meta data from an mdx file in my Next.js project. MDX file example: export const meta = { title: 'title', date: new Date('May 09, 2019'), }; Content export const getStaticProps = async context => { …
2
votes
2 answers

Configure multiple next plugins: withMDX, withBundleAnalyzer

I started a nextjs site with a tailwind blog starter that already comes with withBundleAnalyzer in next.config.js. I am now trying to get .mdx files to work from the pages directly. Documentation says I need withMDX in my nextjs.config file. How do…
yen
  • 1,769
  • 2
  • 15
  • 43
1 2
3
10 11