Transformer API

Transformers are used by the source plugins to parse content. They are automatically used as long as they are installed and found in package.json.

Mime types


A transformer must have a static mimeTypes method which returns an array of mime types the transformer should be able to parse.

Parse content


A transformer must also implement a parse method that will be executed by source plugins to parse content. The method must return a node.

Add GraphQL fields


Transformers can also extend nodes in the GraphQL schema with additional fields by implementing a extendNodeType method. The fields will only be added to nodes it has transformed.


class Transformer {
  static mimeTypes () {
    return ['application/json']

  parse (source) {
    const { title, ...fields } = JSON.parse(source)

    return {

  extendNodeType ({ graphql }) {
    return {
      // custom GraphQL fields for transformed node

module.exports = Transformer

Edit this page on GitHub