Contentful logo

Contentful Community

Search for markdown code blocks

I’m trying to find all entries of a content model that have markdown code blocks in them. I’ve tried to search for triple backticks but I’m not getting any hits in the web app or through the content delivery API. I’ve tried to encode the backticks (%60%60%60) as well.

Is there anyway to preform this search?

Do you want to check all kinds of fields (not only type: text?).

Because otherwise you could probably only look at fields of type ‘text’ (these could potentially include markdown but if u want to filter these, you might have to parse the content of each of these fields).

Name API type JSON type Description Limits Example
Text (Long)1 Text String A long text field for paragraphs of text. Filterable via full-text search. Maximum length is 50,000. “This is a post and …”

https://www.contentful.com/developers/docs/concepts/data-model/

I’m targeting the search to one field in a single content model which is a long text field.

The query is successful but returns an empty array. Here are the calls I’ve made in postman:

https://cdn.contentful.com/spaces/{{space_id}}/entries?access_token={{access_token}}&content_type={{contentType}}&select=fields.title,fields.slug&include=0&fields.body[match]=%60%60%60

https://cdn.contentful.com/spaces/{{space_id}}/entries?access_token={{access_token}}&content_type={{contentType}}&fields.body[match]=```&select=fields.title,fields.slug&include=0