datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 51 forks source link

DatoCmsTextNode AST structure? #84

Closed tbrannam closed 4 years ago

tbrannam commented 4 years ago

I'm comparing gatsby-source-contentful's LongText markdown to DatoCMSTextNode's markdown. The Contentful plugin appears to expose a parsed representation. Is that behavior somehow available, I've noticed that text definitions result in two fields being defined. (fieldName, and fieldNameNode, where fieldNameNode is an object without any apparent useful data).

https://github.com/datocms/gatsby-source-datocms/blob/9fa89d1cd2a591aec2c942e6a5e38584cd0fc46c/src/hooks/sourceNodes/createNodeFromEntity/item/buildTextNode.js#L8

matjack1 commented 4 years ago

@tbrannam sorry for the delay but I've added this to our backlog, we'll be in touch as soon as possible with all the details

stefanoverna commented 4 years ago

@tbrannam read here! https://github.com/datocms/gatsby-source-datocms#multiple-paragraph-text-fields

"Fields of type Multiple-paragraph text will be available both as simple strings (ie. excerpt) and nodes (ie. excerptNode). You can use the latter if you want to apply further transformations, like converting markdown with gatsby-transformer-remark)."

So if you need your markdown to be transformed into html, just add gatsby-transformer-remark in your gatsby-config!