question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to convert dynamic data to MDX

See original GitHub issue

Hello, I got data on GraphCMS in markdown text and I’d like to convert it to MDX. Could you tell me how to do it? I’ve installed mdx-bundler. content: portfolioItem.portfolios[0].content, // <--- it containts the markdown text from GraphCMS. I tried with mdx-remote but there were errors with severity vulnerabilities

I got

import { bundleMDX } from "mdx-bundler";

export const getStaticProps = async ({ params }) => {
  const portfolioItem = await getPortfolioItem(params.slug);
  return {
    props: {
      portfolioItem: portfolioItem.portfolios[0],
      content: portfolioItem.portfolios[0].content,
    },
  };
};

export default function Home({ portfolioItem, content }) {
  console.log(portfolioItem);
  return (
        <div className="prose prose-xl max-w-none mt-4 text-justify  dark:text-gray-100 mb-10">
          {content}
        </div>
  );
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
bubuq3commented, Jun 14, 2021

Thank you, everything works right now 👍 appreciate your help 😄 btw. is it possible to highlight the syntax in js? there is just gray color of the text 😦


    function metamorphose(protagonist,author){
        if( protagonist.name.first === 'Gregor' && author.name.last === 'Kafka' ){
            protagonist.species = 'insect';
        }
    }

image

image

1reaction
Arcathcommented, Jun 14, 2021

Looks like mdx-bundler is doing its job 😃

Is tailwind-typography installed and configured?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a dynamic set - IBM
Procedure · Create a book. · Navigate to the SData database, SalesCube cube, and expand Views. · Click the model dimension tile, and...
Read more >
Converting Calc Formulas to MDX, Hyperion Essbase outlines ...
The storage characteristics of a member and hence all its associated cells are defined in a block storage outline through dynamic calc (and...
Read more >
How to Source MDX Content in Next.js to Dynamically Create ...
To learn how to add MDX to a project, we're going first source a few MDX files, using blog posts as an example,...
Read more >
Analysis Services MDX Query Designer (Power Pivot)
Open the Power Pivot window. · Click Home > Get External Data > From Database > From Analysis Services or Power Pivot. ·...
Read more >
Part 5: Transform Data to Use MDX - Gatsby
Under allMdx , open the nodes dropdown. Inside the frontmatter dropdown, you should see fields for all the keys you created in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found