1. Docs
  2. Formulas
  3. Functions

TO_MARKDOWN_CODEBLOCK

Format text as a fenced markdown code block, with an optional language for syntax highlighting. The fence is lengthened past the longest run of backticks in the text, so content that itself contains a fenced block cannot close the block early.

Categories: Text

Syntax

TO_MARKDOWN_CODEBLOCK(text, [language])

Examples

Example 1

Input

1
{
2
"my_action": {
3
"snippet": "print('hello')"
4
}
5
}

Formula

TO_MARKDOWN_CODEBLOCK(my_action.snippet, "python")

Output

"```python\nprint('hello')\n```"

Example 2: The language is optional.

Input

1
{
2
"my_action": {
3
"snippet": "print('hello')"
4
}
5
}

Formula

TO_MARKDOWN_CODEBLOCK(my_action.snippet)

Output

"```\nprint('hello')\n```"
Was this helpful?