Skip to content
Last updated

Markdoc functions

Products:RevelRevelReefReefRealmRealm
Plans:ProEnterpriseEnterprise+

Markdoc functions add powerful capabilities to your Markdown content, enabling conditional logic and data manipulation.

Functions are typically used in two main ways:

  1. Conditional rendering: Inside {% if %} tags to control whether a block of content is displayed based on variable values or other conditions.
  2. Direct output: Within {% ... %} delimiters to directly output a computed value into the content.

Call functions

Call functions using a syntax similar to programming languages:

{% functionName(argument1, argument2, ...) %}

Arguments can be literal values (strings, numbers, booleans), variables (like $frontmatter.seo.title or $rbac.teams), or results of other functions.

Resources

  • Built-in functions overview - Explore standard Markdoc functions available for content manipulation and dynamic value generation
  • Build custom Markdoc functions - Learn to define and integrate your own custom functions for advanced content processing and dynamic features
  • includes function - Use a Markdoc function that checks if an array contains a specific value.
  • concat function - Use a Markdoc function that joins multiple arguments into a single string.