graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

Embedding GraphiQL via markdown

Open FrankR85 opened this issue 4 years ago • 6 comments

Is there a documentation how we can integrate GraphiQL in our existing markdown-based documentation?

We`d like to have something like this:

# { "graphiql": true }
{
  hero {
    name
  }
}

Is there a tutorial or something like that on how they did that?

FrankR85 avatar Dec 14 '20 13:12 FrankR85

You mean like this?

# { "graphiql": true }
{
  hero {
    name
  }
}

Use ```graphql in the beginning of your code block.

PrakharUniyal avatar Dec 16 '20 06:12 PrakharUniyal

I guess this gives me just the syntax highlighting. What I really want is the embedded GraphiQL client, like on the Learn GraphQL website.

FrankR85 avatar Dec 16 '20 06:12 FrankR85

@FrankR85 possibly their source code is available? I’ll circle back because we would like this feature for graphql dot org.

acao avatar Jan 11 '21 14:01 acao

@FrankR85 on graphql.org MiniGraphiql component is used with the marked which is probably not as powerful as graphiql but good enough for the docs site

saihaj avatar Jan 18 '21 05:01 saihaj

yep! you can build an editor with our codemirror-graphql or monaco-graphql quite easily, like MiniGraphiQL does

acao avatar Jan 18 '21 12:01 acao

considering closing this as it's more of a support issue. you can try asking around on the discord possibly. would be cool to have a utility for this, but then we would have to choose one of many markdown parsers to support.

it's best for a third party implentation as a library, but it would be nice if we could have a demo for something like this in 2.0

if you'd like to keep this open, can we convert it to a discussion?

acao avatar Feb 06 '21 15:02 acao