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.

Not clear how to display markdown that is not coming from a file

See original GitHub issue

I have a graphql API for a blog that contains fields that have formatting with markdown/mdx. I’d like to render that markdown using Gatsby. The docs of gatsby-transformer-markdown only show how to do this when the markdown is coming from static files. However I’d like to know how to do this with plain strings in gatsby-node.js and createPage.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
vladarcommented, Dec 19, 2019

@jfrolich Yes, an alternative is to define custom resolvers for such fields (using createResolvers API) and parse markdown in those resolvers. In fact, our example for gatsby-source-graphql does something similar.

See post field resolver for inspiration:

https://github.com/gatsbyjs/gatsby/blob/f274630b7a2702b0687471fc8f6536a7bebb73c6/examples/using-gatsby-source-graphql/gatsby-node.js#L49-L55

1reaction
sidharthachatterjeecommented, Jan 16, 2020

Looks like this is resolved with help from @vladar and @LekoArts (thanks folks)

Let’s go ahead and close this. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

View markdown files offline - github - Stack Overflow
I'm referring to showing the README.md file as it would come out in Github, and not as for editing purposes. Needs to work...
Read more >
Basic Syntax - Markdown Guide
The Markdown elements outlined in the original design document. ... Not all elements can be used — you'll need to experiment to see...
Read more >
15 Common Problems with rmarkdown (and some solutions)
15 Common Problems with rmarkdown (and some solutions) · 15.1 Avoiding problems · 15.2 The errors · 15.3 “Duplication”: Duplicated chunk names ·...
Read more >
Readme markdown not rendering in Xcode - Apple Developer
In Xcode 11.1, I created a 'README.md' markdown file, but it always renders as its raw text (yet font size changes depending on...
Read more >
Markdown editing with Visual Studio Code
Working with Markdown files in Visual Studio Code is simple, straightforward, ... A warning shown in the editor when linking to a file...
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