General Remark (Markdown) filter in GraphQL
See original GitHub issueSummary
As briefly noted here, it’d be useful to have Remark parse arbitrary data fields. This’d be even better if handled at the GraphQL data layer, because then the browser never has to process Markdown at all.
Basic example
<page-query>
query Post($id: String) {
post(id: $id) {
body(markdown: true)
}
}
</page-query>
We’d then expect $page.post.body
to be pre-rendered, ready to pass to v-html
.
Motivation
I don’t just want Remark to parse .md
files; in my case, Netlify CMS stores chunks of Markdown in my content’s .yml
files wherever there’s a rich text field.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How can I filter graph ql query based on markdown frontmatter?
I think the filter should be on the allMarkdownRemark : { allMarkdownRemark ( filter: { frontmatter: { type: { eq: "folio" } }...
Read more >GraphQL API style guide - GitLab Docs
Aliasing and deprecating mutations. Marking schema items as Alpha. How to filter Kibana for queries that used deprecated fields. Create a deprecation issue....
Read more >Keeping certain parts of your GraphQL schema hidden from ...
However, Directives are part of the general GraphQL Specification, ... A directive that will filter things from the Introspection Query ...
Read more >Working Draft - GraphQL
GraphQL source documents may contain single-line comments, starting with the ... GraphQL descriptions are defined using the Markdown syntax (as specified by ...
Read more >Create a Markdown Blog Using Next.js - Joy of Code
There are remark plugins that process Markdown and rehype plugins that ... so it would be nice being able to filter them by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, it would be really nice to be able to parse any markdown content in the GraphQL layer 😃 We are working on a new schema API which could allow a plugin to for example add a
@markdown
directive which could be used on anyString
field to transform it to HTML. The API will be ready within a couple of weeks.I came up with this solution.
first
npm install markdown-it --save
In gridsome.server.js, require it:
var MarkdownIt = require('markdown-it')
then add:
Then you can use
body(markdown: true)
in your GraphQL for that field.That’s it!