Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When designing Gatsby's data system I originally thought all nodes
should have a media type as a way of signaling to transformer plugins
how they could transform its data.
But while writing more source/transformer plugins and sites I've realized
that most nodes are at a terminal/leaf state, full decomposed with no more need of
transformation. For these nodes, they have no need to set a mediaType because
they're already 100% primitive data types.
So setting mediaType is now opt-in and should only be used when a node
has unprocessed raw data that they don't want to take responsibility for processing
themselves futher.
A common example is markdown. Markdown is commonly used for building websites
and is a supported input type for many CMSs or other online content creation
services.
A source plugin for one of these services will generally want to create nodes
for the markdown and set the mediaType to
text/x-markdown
so Gatsby transformerplugins that understand Markdown can then handle converting the markdown into
other formats.
But the markdown transformer plugin, when it creates transformed nodes, won't want
to set a mediaType as the nodes it creates will now be fully decomposed into
transformed HTML, frontmatter fields, etc.