Giter Club home page Giter Club logo

Comments (3)

YoshiWalsh avatar YoshiWalsh commented on September 24, 2024

I have reproduced this issue and will try to work out what causes it and how to fix it.

In the meantime, it appears your use-case is pretty much what remark-behead does. Is it possible possible to use remark plugins with gatsby-yaml-full-markdown?

from gatsby-plugin-excerpts.

YoshiWalsh avatar YoshiWalsh commented on September 24, 2024

Fixed the issue, please update to version 1.1.0.

Also I changed your config file a bit based on what I think you're trying to do:

    {
      resolve: `gatsby-plugin-excerpts`,
      options: {
        sources: {
          beheadedDescription: {
            type: 'htmlQuery',
            sourceField: 'description',
            excerptSelector: 'body > *',
            elementReplacements: [
              {
                selector: 'h6',
                replaceWith: 'strong'
              },
              {
                selector: 'h5',
                replaceWith: 'h6'
              },
              {
                selector: 'h4',
                replaceWith: 'h5'
              },
              {
                selector: 'h3',
                replaceWith: 'h4'
              },
              {
                selector: 'h2',
                replaceWith: 'h3'
              },
              {
                selector: 'h1',
                replaceWith: 'h2'
              },
            ],
          },
        },
        sourceSets: {
          beheadDescription: [
            `beheadedDescription`
          ]
        },
        excerpts: {
          processedDescription: {
            type: `html`,
            nodeTypeSourceSet: {
              ContentYaml: `beheadDescription`
            }
          }
        }
      },
    }

Now in GraphQL Explorer:

query MyQuery {
  contentYaml {
    name
    description
    processedDescription
  }
}
{
  "data": {
    "contentYaml": {
      "name": "Dropbox",
      "description": "<h1>test</h1>\n<p><strong>Wherever you are</strong><br>\nPut your stuff in Dropbox and get to it from your computers, phones, or tablets. Edit docs, automatically add photos, and show off videos from anywhere.</p>\n",
      "processedDescription": "<h2>test</h2><p><strong>Wherever you are</strong><br>\nPut your stuff in Dropbox and get to it from your computers, phones, or tablets. Edit docs, automatically add photos, and show off videos from anywhere.</p>"
    }
  }
}

from gatsby-plugin-excerpts.

ianhirschfeld avatar ianhirschfeld commented on September 24, 2024

Thank you for the update and quick turn around! There is something else that I may have found, but I will put it in a new ticket since it not be related.

from gatsby-plugin-excerpts.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.