Skip to content

GraphQL API - styles missing #105

@angeloashmore

Description

@angeloashmore

Hi @andrewbranch, awesome plugin. Thank you for creating this. It seriously blows my mind that we can use VS Code extensions with Markdown.

I'm not sure if the GraphQL API is meant to be used yet as I see it on the V3 roadmap, but I'm experiencing issues using it on v2.1.2.

I'm able to successfully query for the generated HTML using the grvscCodeBlocks field via GraphQL. Unfortunately, the <style> element is not included on the first query.

If I edit a query and save, likely causing Gatsby to rerun queries, the style element is included. It's worth noting that the HTML includes the correct theme classname even if the style element is missing.

Could there be an async problem somewhere in the code? I tried to read through it but, admittedly, it's quite complex and hard to track down.

My query looks something like the following where frontmatter.poster is a File node linked to another Markdown file.

query PostTemplate($id: String!) {
  markdownRemark(id: { eq: $id }) {
    frontmatter {
      poster {
        childMarkdownRemark {
          grvscCodeBlocks {
            html
          }
        }
      }
    }
  }
}

What it looks like on the first query execution without <style>:
image

What it should look like:
image

Please let me know if you need more details. I can also help track down the issue if you can point me to the relevant part of the code. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions