How to use the gridsome/graphql.GraphQLList function in gridsome

To help you get started, we’ve selected a few gridsome examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gridsome / gridsome / packages / transformer-remark / index.js View on Github external
extendNodeType () {
    return {
      content: {
        type: GraphQLString,
        resolve: node => this._nodeToHTML(node)
      },
      headings: {
        type: new GraphQLList(HeadingType),
        args: {
          depth: { type: HeadingLevels },
          stripTags: { type: GraphQLBoolean, defaultValue: true }
        },
        resolve: async (node, { depth, stripTags }) => {
          const key = cacheKey(node, 'headings')
          let headings = cache.get(key)

          if (!headings) {
            const ast = await this._nodeToAST(node)
            headings = findHeadings(ast)
            cache.set(key, headings)
          }

          return headings
            .filter(heading =>

gridsome

A JAMstack framework for building blazing fast websites with Vue.js

MIT
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis