Builtin functions

Function NameDescriptionParametersExample
absReturns the absolute value of the given number.numberabs(number)
addAdds two values.value1, value2add(value1, value2)
andPerforms a logical AND operation on two boolean values.value1, value2and(value1, value2)
arrayCreates an array from the given values.valuesarray(values)
arraysReturns array if input is array, None otherwiseaarrays(a)
assertVerifies that a condition is true and raises an error if it’s false.condassert(cond)
assertAsserts that two values are equal, returns the value if true, otherwise raises an error.value1, value2assert(value1, value2)
base64Encodes the given string to base64.inputbase64(input)
base64dDecodes the given base64 string.inputbase64d(input)
booleansReturns boolean if input is boolean, None otherwisebbooleans(b)
ceilRounds the given number up to the nearest integer.numberceil(number)
compactRemoves None values from the given array.arraycompact(array)
containsChecks if string contains a substringhaystack, needlecontains(haystack, needle)
csv2tableConvert csv string to markdown tablecsvcsv2table(csv)
debugPrints the debug information of the given value.valuedebug(value)
delDeletes the element at the specified index in the array or string.array_or_string, indexdel(array_or_string, index)
divDivides the first value by the second value.value1, value2div(value1, value2)
downcaseConverts the given string to lowercase.inputdowncase(input)
ends_withChecks if the given string ends with the specified substring.string, substringends_with(string, substring)
eqChecks if two values are equal.value1, value2eq(value1, value2)
errorRaises a user-defined error with the specified message.messageerror(message)
explodeSplits the given string into an array of characters.stringexplode(string)
filterFilters the elements of an array based on a provided callback function.v, ffilter(v, f)
firstReturns the first element of an arrayarrfirst(arr)
floorRounds the given number down to the nearest integer.numberfloor(number)
from_dateConverts a date string to a timestamp.date_strfrom_date(date_str)
get_md_list_levelReturns the indent level of a markdown list node.listget_md_list_level(list)
get_titleReturns the title of a markdown node.nodeget_title(node)
gsubReplaces all occurrences matching a regular expression pattern with the replacement string.pattern, from, togsub(pattern, from, to)
gtChecks if the first value is greater than the second value.value1, value2gt(value1, value2)
gteChecks if the first value is greater than or equal to the second value.value1, value2gte(value1, value2)
haltTerminates the program with the given exit code.exit_codehalt(exit_code)
halt_errorHalts execution with error code 5halt_error()
implodeJoins an array of characters into a string.arrayimplode(array)
indexFinds the first occurrence of a substring in the given string.string, substringindex(string, substring)
is_arrayChecks if input is an arrayais_array(a)
is_boolChecks if input is a booleanbis_bool(b)
is_codeChecks if markdown is code blockmdis_code(md)
is_emChecks if markdown is emphasismdis_em(md)
is_emptyChecks if string or array is emptysis_empty(s)
is_hChecks if markdown is headingmdis_h(md)
is_h1Checks if markdown is h1 headingmdis_h1(md)
is_h2Checks if markdown is h2 headingmdis_h2(md)
is_h3Checks if markdown is h3 headingmdis_h3(md)
is_h4Checks if markdown is h4 headingmdis_h4(md)
is_h5Checks if markdown is h5 headingmdis_h5(md)
is_htmlChecks if markdown is htmlmdis_html(md)
is_listChecks if markdown is listlistis_list(list)
is_list1Checks if markdown is list with indentation level 1listis_list1(list)
is_list2Checks if markdown is list with indentation level 2listis_list2(list)
is_list3Checks if markdown is list with indentation level 3listis_list3(list)
is_markdownChecks if input is markdownmis_markdown(m)
is_mdxChecks if markdown is MDXmdxis_mdx(mdx)
is_mdx_flow_expressionChecks if markdown is MDX Flow Expressionmdxis_mdx_flow_expression(mdx)
is_mdx_js_esmChecks if markdown is MDX Js Esmmdxis_mdx_js_esm(mdx)
is_mdx_jsx_flow_elementChecks if markdown is MDX Jsx Flow Elementmdxis_mdx_jsx_flow_element(mdx)
is_mdx_jsx_text_elementChecks if markdown is MDX Jsx Text Elementmdxis_mdx_jsx_text_element(mdx)
is_mdx_text_expressionChecks if markdown is MDX Text Expressionmdxis_mdx_text_expression(mdx)
is_noneChecks if input is Nonenis_none(n)
is_numberChecks if input is a numbernis_number(n)
is_stringChecks if input is a stringsis_string(s)
is_textChecks if markdown is texttextis_text(text)
is_tomlChecks if markdown is tomlmdis_toml(md)
is_yamlChecks if markdown is yamlmdis_yaml(md)
joinJoins the elements of an array into a string with the given separator.array, separatorjoin(array, separator)
lastReturns the last element of an arrayarrlast(arr)
lenReturns the length of the given string or array.valuelen(value)
ltChecks if the first value is less than the second value.value1, value2lt(value1, value2)
lteChecks if the first value is less than or equal to the second value.value1, value2lte(value1, value2)
ltrimstrRemoves prefix string from input if it existss, leftltrimstr(s, left)
mapApplies a given function to each element of the provided array and returns a new array with the results.v, fmap(v, f)
markdownsReturns markdown if input is markdown, None otherwisemmarkdowns(m)
matchFinds all matches of the given pattern in the string.string, patternmatch(string, pattern)
maxReturns the maximum of two values.value1, value2max(value1, value2)
minReturns the minimum of two values.value1, value2min(value1, value2)
modCalculates the remainder of the division of the first value by the second value.value1, value2mod(value1, value2)
mulMultiplies two values.value1, value2mul(value1, value2)
neChecks if two values are not equal.value1, value2ne(value1, value2)
notPerforms a logical NOT operation on a boolean value.valuenot(value)
nowReturns the current timestamp.now()
nthGets the element at the specified index in the array or string.array_or_string, indexnth(array_or_string, index)
numbersReturns number if input is number, None otherwisennumbers(n)
orPerforms a logical OR operation on two boolean values.value1, value2or(value1, value2)
powRaises the base to the power of the exponent.base, exponentpow(base, exponent)
rangeCreates an array of numbers within the specified range.start, endrange(start, end)
repeatRepeats the given string a specified number of times.string, countrepeat(string, count)
replaceReplaces all occurrences of a substring with another substring.string, from, toreplace(string, from, to)
reverseReverses the given string or array.valuereverse(value)
rindexFinds the last occurrence of a substring in the given string.string, substringrindex(string, substring)
roundRounds the given number to the nearest integer.numberround(number)
rtrimstrRemoves suffix string from input if it existss, rightrtrimstr(s, right)
selectReturns value if condition is true, None otherwisev, fselect(v, f)
set_checkCreates a markdown list node with the given checked state.list, checkedset_check(list, checked)
set_refSets the reference identifier for markdown nodes that support references (e.g., Definition, LinkRef, ImageRef, Footnote, FootnoteRef).node, reference_idset_ref(node, reference_id)
sliceExtracts a substring from the given string.string, start, endslice(string, start, end)
sortSorts the elements of the given array.arraysort(array)
splitSplits the given string by the specified separator.string, separatorsplit(string, separator)
starts_withChecks if the given string starts with the specified substring.string, substringstarts_with(string, substring)
subSubtracts the second value from the first value.value1, value2sub(value1, value2)
testTests if string matches a patterns, patterntest(s, pattern)
to_arrayConverts input to an arrayato_array(a)
to_codeCreates a markdown code block with the given value and language.value, languageto_code(value, language)
to_code_inlineCreates an inline markdown code node with the given value.valueto_code_inline(value)
to_csvConverts the given value to a CSV.valueto_csv(value)
to_dateConverts a timestamp to a date string with the given format.timestamp, formatto_date(timestamp, format)
to_date_iso8601Formats a date to ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)dto_date_iso8601(d)
to_emCreates a markdown emphasis (italic) node with the given value.valueto_em(value)
to_hCreates a markdown heading node with the given value and depth.value, depthto_h(value, depth)
to_hrCreates a markdown horizontal rule node.to_hr()
to_htmlConverts the given markdown string to HTML.markdownto_html(markdown)
to_imageCreates a markdown image node with the given URL, alt text, and title.url, alt, titleto_image(url, alt, title)
to_linkCreates a markdown link node with the given url and title.url, value, titleto_link(url, value, title)
to_mathCreates a markdown math block with the given value.valueto_math(value)
to_math_inlineCreates an inline markdown math node with the given value.valueto_math_inline(value)
to_md_listCreates a markdown list node with the given value and indent level.value, indentto_md_list(value, indent)
to_md_nameReturns the name of the given markdown node.markdownto_md_name(markdown)
to_md_table_rowCreates a markdown table row node with the given values.cellsto_md_table_row(cells)
to_md_textCreates a markdown text node with the given value.valueto_md_text(value)
to_numberConverts the given value to a number.valueto_number(value)
to_stringConverts the given value to a string.valueto_string(value)
to_strongCreates a markdown strong (bold) node with the given value.valueto_strong(value)
to_textConverts the given markdown node to plain text.markdownto_text(markdown)
to_tsvConverts the given value to a TSV.valueto_tsv(value)
trimTrims whitespace from both ends of the given string.inputtrim(input)
truncTruncates the given number to an integer by removing the fractional part.numbertrunc(number)
tsv2tableConvert tsv string to markdown tabletsvtsv2table(tsv)
typeReturns the type of the given value.valuetype(value)
uniqRemoves duplicate elements from the given array.arrayuniq(array)
upcaseConverts the given string to uppercase.inputupcase(input)
updateUpdate the value with specified value.target_value, source_valueupdate(target_value, source_value)
url_encodeURL-encodes the given string.inputurl_encode(input)