276 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
abs |
Returns the absolute value of the given number. | number |
abs(number) |
add |
Adds two values. | value1, value2 |
add(value1, value2) |
all |
Returns true if all element in the array satisfies the provided function. | v, f |
all(v, f) |
all_symbols |
Returns an array of all interned symbols. | all_symbols() |
|
and |
Performs a logical AND operation on two boolean values. | value1, value2 |
and(value1, value2) |
any |
Returns true if any element in the array satisfies the provided function. | v, f |
any(v, f) |
array |
Creates an array from the given values. | values |
array(values) |
arrays |
Returns array if input is array, None otherwise | a |
arrays(a) |
assert |
Asserts that two values are equal, returns the value if true, otherwise raises an error. | value1, value2 |
assert(value1, value2) |
attr |
Retrieves the value of the specified attribute from a markdown node. | markdown, attribute |
attr(markdown, attribute) |
base64 |
Encodes the given string to base64. | input |
base64(input) |
base64d |
Decodes the given base64 string. | input |
base64d(input) |
base64url |
Encodes the given string to URL-safe base64. | input |
base64url(input) |
base64urld |
Decodes the given URL-safe base64 string. | input |
base64urld(input) |
between |
Checks if a value is between min and max (inclusive). | value, min, max |
between(value, min, max) |
booleans |
Returns boolean if input is boolean, None otherwise | b |
booleans(b) |
breakpoint |
Sets a breakpoint for debugging; execution will pause at this point if a debugger is attached. | breakpoint() |
|
bsearch |
Performs a binary search on a sorted array to find the index of the target value. | arr, target |
bsearch(arr, target) |
capture |
Captures named groups from the given string based on the specified regular expression pattern and returns them as a dictionary keyed by group names. | string, pattern |
capture(string, pattern) |
ceil |
Rounds the given number up to the nearest integer. | number |
ceil(number) |
coalesce |
Returns the first non-None value from the two provided arguments. | value1, value2 |
coalesce(value1, value2) |
compact |
Removes None values from the given array. | array |
compact(array) |
compact_map |
Maps over an array and removes None values from the result. | arr, f |
compact_map(arr, f) |
contains |
Checks if string contains a substring | haystack, needle |
contains(haystack, needle) |
convert |
Converts the input value to the specified format. Supported formats: base64, html, text, uri, heading (#, ##, etc.), blockquote (>), list item (-), or link (URL). | input, format |
convert(input, format) |
count_by |
Returns the count of elements in the array that satisfy the provided function. | arr, f |
count_by(arr, f) |
debug |
Prints the debug information of the given value(s). | args |
debug(args) |
decrease_header_depth |
Decreases the depth (numeric level) of a markdown heading node by one, effectively promoting the heading (e.g. h2 -> h1), down to a minimum of 1. | node |
decrease_header_depth(node) |
decrease_header_level |
Deprecated: use `decrease_header_depth` or `promote_heading` instead. Kept for backward compatibility; behavior unchanged. | node |
decrease_header_level(node) |
del |
Deletes the element at the specified index in the array or string. | array_or_string, index |
del(array_or_string, index) |
demote_heading |
Demotes a markdown heading by increasing its depth (numeric level) by one. This is an alias for `increase_header_depth`. | node |
demote_heading(node) |
dict |
Creates a new, empty dict. | dict() |
|
div |
Divides the first value by the second value. | value1, value2 |
div(value1, value2) |
downcase |
Converts the given string to lowercase. | input |
downcase(input) |
each |
Executes a provided function once for each element in an array or each key-value pair in a dictionary. | v, f |
each(v, f) |
ends_with |
Checks if the given string ends with the specified substring. | string, substring |
ends_with(string, substring) |
entries |
Returns an array of key-value pairs from the dict as arrays. | dict |
entries(dict) |
eq |
Checks if two values are equal. | value1, value2 |
eq(value1, value2) |
error |
Raises a user-defined error with the specified message. | message |
error(message) |
explode |
Splits the given string into an array of characters. | string |
explode(string) |
fill |
Returns an array of length n filled with the given value. | value, n |
fill(value, n) |
filter |
Filters the elements of an array based on a provided callback function. | v, f |
filter(v, f) |
find_index |
Returns the index of the first element in an array that satisfies the provided function. | arr, f |
find_index(arr, f) |
first |
Returns the first element of an array | arr |
first(arr) |
flat_map |
Applies a function to each element and flattens the result into a single array | v, f |
flat_map(v, f) |
flatten |
Flattens a nested array into a single level array. | array |
flatten(array) |
floor |
Rounds the given number down to the nearest integer. | number |
floor(number) |
fold |
Reduces an array to a single value by applying a function, starting from an initial value. | arr, init, f |
fold(arr, init, f) |
from_date |
Converts a date string to a timestamp. | date_str |
from_date(date_str) |
get |
Retrieves a value from a dict by its key. Returns None if the key is not found. | obj, key |
get(obj, key) |
get_or |
Safely gets a value from a dict with a default if the key doesn't exist. | dict, key, default |
get_or(dict, key, default) |
get_title |
Returns the title of a markdown node. | node |
get_title(node) |
get_url |
Returns the url of a markdown node. | node |
get_url(node) |
get_variable |
Retrieves the value of a symbol or variable from the current environment. | symbol_or_string |
get_variable(symbol_or_string) |
group_by |
Groups elements of an array by the result of applying a function to each element | arr, f |
group_by(arr, f) |
gsub |
Replaces all occurrences matching a regular expression pattern with the replacement string. | from, pattern, to |
gsub(from, pattern, to) |
gt |
Checks if the first value is greater than the second value. | value1, value2 |
gt(value1, value2) |
gte |
Checks if the first value is greater than or equal to the second value. | value1, value2 |
gte(value1, value2) |
halt |
Terminates the program with the given exit code. | exit_code |
halt(exit_code) |
halt_error |
Halts execution with error code 5 | halt_error() |
|
identity |
Returns the input value unchanged. | x |
identity(x) |
implode |
Joins an array of characters into a string. | array |
implode(array) |
in |
Returns true if the element is in the array. | v, elem |
in(v, elem) |
increase_header_depth |
Increases the depth (numeric level) of a markdown heading node by one, effectively demoting the heading (e.g. h1 -> h2), up to a maximum of 6. | node |
increase_header_depth(node) |
increase_header_level |
Deprecated: use `increase_header_depth` or `demote_heading` instead. Kept for backward compatibility; behavior unchanged. | node |
increase_header_level(node) |
index |
Finds the first occurrence of a substring in the given string. | string, substring |
index(string, substring) |
index_by |
Creates a dictionary indexed by a key extracted from each element. | arr, f |
index_by(arr, f) |
infinite |
Returns an infinite number value. | infinite() |
|
input |
Reads a line from standard input and returns it as a string. | input() |
|
insert |
Inserts a value into an array or string at the specified index, or into a dict with the specified key. | target, index_or_key, value |
insert(target, index_or_key, value) |
inspect |
Inspects a value by printing its string representation and returning the value. | value |
inspect(value) |
intern |
Interns the given string, returning a canonical reference for efficient comparison. | string |
intern(string) |
is_array |
Checks if input is an array | a |
is_array(a) |
is_bool |
Checks if input is a boolean | b |
is_bool(b) |
is_code |
Checks if markdown is code block | md |
is_code(md) |
is_debug_mode |
Checks if the runtime is currently in debug mode, returning true if a debugger is attached. | is_debug_mode() |
|
is_dict |
Checks if input is a dictionary | d |
is_dict(d) |
is_em |
Checks if markdown is emphasis | md |
is_em(md) |
is_empty |
Checks if string, array or dict is empty | s |
is_empty(s) |
is_h |
Checks if markdown is heading | md |
is_h(md) |
is_h1 |
Checks if markdown is h1 heading | md |
is_h1(md) |
is_h2 |
Checks if markdown is h2 heading | md |
is_h2(md) |
is_h3 |
Checks if markdown is h3 heading | md |
is_h3(md) |
is_h4 |
Checks if markdown is h4 heading | md |
is_h4(md) |
is_h5 |
Checks if markdown is h5 heading | md |
is_h5(md) |
is_h6 |
Checks if markdown is h6 heading | md |
is_h6(md) |
is_h_level |
Checks if markdown is a heading of the specified level (1-6) | md, level |
is_h_level(md, level) |
is_html |
Checks if markdown is html | md |
is_html(md) |
is_list |
Checks if markdown is list | list |
is_list(list) |
is_markdown |
Checks if input is markdown | m |
is_markdown(m) |
is_mdx |
Checks if markdown is MDX | mdx |
is_mdx(mdx) |
is_mdx_flow_expression |
Checks if markdown is MDX Flow Expression | mdx |
is_mdx_flow_expression(mdx) |
is_mdx_js_esm |
Checks if markdown is MDX Js Esm | mdx |
is_mdx_js_esm(mdx) |
is_mdx_jsx_flow_element |
Checks if markdown is MDX Jsx Flow Element | mdx |
is_mdx_jsx_flow_element(mdx) |
is_mdx_jsx_text_element |
Checks if markdown is MDX Jsx Text Element | mdx |
is_mdx_jsx_text_element(mdx) |
is_mdx_text_expression |
Checks if markdown is MDX Text Expression | mdx |
is_mdx_text_expression(mdx) |
is_none |
Checks if input is None | n |
is_none(n) |
is_number |
Checks if input is a number | n |
is_number(n) |
is_regex_match |
Checks if the given pattern matches the string. | string, pattern |
is_regex_match(string, pattern) |
is_string |
Checks if input is a string | s |
is_string(s) |
is_table_align |
Checks if markdown is table align | md |
is_table_align(md) |
is_table_cell |
Checks if markdown is table cell | md |
is_table_cell(md) |
is_text |
Checks if markdown is text | text |
is_text(text) |
is_toml |
Checks if markdown is toml | md |
is_toml(md) |
is_yaml |
Checks if markdown is yaml | md |
is_yaml(md) |
join |
Joins the elements of an array into a string with the given separator. | array, separator |
join(array, separator) |
keys |
Returns an array of keys from the dict. | dict |
keys(dict) |
last |
Returns the last element of an array | arr |
last(arr) |
len |
Returns the length of the given string or array. | value |
len(value) |
load_markdown |
Loads a markdown file from the specified path | path |
load_markdown(path) |
lpad |
Left-pads a string to a specified length using a given padding string. | s, length, pad_str |
lpad(s, length, pad_str) |
lt |
Checks if the first value is less than the second value. | value1, value2 |
lt(value1, value2) |
lte |
Checks if the first value is less than or equal to the second value. | value1, value2 |
lte(value1, value2) |
ltrim |
Trims whitespace from the left end of the given string. | input |
ltrim(input) |
ltrimstr |
Removes prefix string from input if it exists | s, left |
ltrimstr(s, left) |
map |
Applies a given function to each element of the provided array and returns a new array with the results. | v, f |
map(v, f) |
markdowns |
Returns markdown if input is markdown, None otherwise | m |
markdowns(m) |
matches_url |
Checks if markdown node's URL matches a specified URL deprecated: use select(.link.url == url) instead | node, url |
matches_url(node, url) |
max |
Returns the maximum of two values. | value1, value2 |
max(value1, value2) |
min |
Returns the minimum of two values. | value1, value2 |
min(value1, value2) |
mod |
Calculates the remainder of the division of the first value by the second value. | value1, value2 |
mod(value1, value2) |
mul |
Multiplies two values. | value1, value2 |
mul(value1, value2) |
nan |
Returns a Not-a-Number (NaN) value. | nan() |
|
ne |
Checks if two values are not equal. | value1, value2 |
ne(value1, value2) |
negate |
Returns the negation of the given number. | number |
negate(number) |
not |
Performs a logical NOT operation on a boolean value. | value |
not(value) |
now |
Returns the current timestamp. | now() |
|
numbers |
Returns number if input is number, None otherwise | n |
numbers(n) |
or |
Performs a logical OR operation on two boolean values. | value1, value2 |
or(value1, value2) |
partition |
Splits an array into two arrays: [matching, not_matching] based on a condition. | arr, f |
partition(arr, f) |
pluck |
Extracts values from an array of objects based on a specified selector. | pluck_obj, selector |
pluck(pluck_obj, selector) |
pow |
Raises the base to the power of the exponent. | base, exponent |
pow(base, exponent) |
print |
Prints a message to standard output and returns the current value. | message |
print(message) |
promote_heading |
Promotes a markdown heading by decreasing its depth (numeric level) by one. This is an alias for `decrease_header_depth`. | node |
promote_heading(node) |
range |
Creates an array from start to end with an optional step. | start, end, step |
range(start, end, step) |
read_file |
Reads the contents of a file at the given path and returns it as a string. | path |
read_file(path) |
regex_match |
Finds all matches of the given pattern in the string. | string, pattern |
regex_match(string, pattern) |
reject |
Filters out elements that match the condition (opposite of filter). | arr, f |
reject(arr, f) |
repeat |
Repeats the given string a specified number of times. | string, count |
repeat(string, count) |
replace |
Replaces all occurrences of a substring with another substring. | from, pattern, to |
replace(from, pattern, to) |
reverse |
Reverses the given string or array. | value |
reverse(value) |
rindex |
Finds the last occurrence of a substring in the given string. | string, substring |
rindex(string, substring) |
round |
Rounds the given number to the nearest integer. | number |
round(number) |
rpad |
Right-pads a string to a specified length using a given padding string. | s, length, pad_str |
rpad(s, length, pad_str) |
rtrim |
Trims whitespace from the right end of the given string. | input |
rtrim(input) |
rtrimstr |
Removes suffix string from input if it exists | s, right |
rtrimstr(s, right) |
second |
Returns the second element of an array | arr |
second(arr) |
select |
Returns value if condition is true, None otherwise | v, f |
select(v, f) |
set |
Sets a key-value pair in a dict. If the key exists, its value is updated. Returns the modified map. | obj, key, value |
set(obj, key, value) |
set_attr |
Sets the value of the specified attribute on a markdown node. | markdown, attribute, value |
set_attr(markdown, attribute, value) |
set_check |
Creates a markdown list node with the given checked state. | list, checked |
set_check(list, checked) |
set_code_block_lang |
Sets the language of a markdown code block node. | code_block, language |
set_code_block_lang(code_block, language) |
set_list_ordered |
Sets the ordered property of a markdown list node. | list, ordered |
set_list_ordered(list, ordered) |
set_ref |
Sets the reference identifier for markdown nodes that support references (e.g., Definition, LinkRef, ImageRef, Footnote, FootnoteRef). | node, reference_id |
set_ref(node, reference_id) |
set_variable |
Sets a symbol or variable in the current environment with the given value. | symbol_or_string, value |
set_variable(symbol_or_string, value) |
shift_left |
Performs a left shift operation on the given value: for numbers, this is a bitwise left shift by the specified number of positions; for strings, this removes characters from the start; for Markdown headings, this increases the heading level accordingly. | value, shift_amount |
shift_left(value, shift_amount) |
shift_right |
Performs a bitwise right shift on numbers, slices characters from the end of strings, and adjusts Markdown heading levels when applied to headings, using the given shift amount. | value, shift_amount |
shift_right(value, shift_amount) |
skip |
Skips the first n elements of an array and returns the rest | arr, n |
skip(arr, n) |
skip_while |
Skips elements from the beginning of an array while the provided function returns true | arr, f |
skip_while(arr, f) |
slice |
Extracts a substring from the given string. | string, start, end |
slice(string, start, end) |
slugify |
Converts a string into a URL-friendly slug by lowercasing, replacing non-alphanumeric characters with hyphens, and trimming hyphens from the ends. | s, separator |
slugify(s, separator) |
sort |
Sorts the elements of the given array. | array |
sort(array) |
sort_by |
Sorts an array using a key function that extracts a comparable value for each element. | arr, f |
sort_by(arr, f) |
split |
Splits the given string by the specified separator. | string, separator |
split(string, separator) |
starts_with |
Checks if the given string starts with the specified substring. | string, substring |
starts_with(string, substring) |
stderr |
Prints a message to standard error and returns the current value. | message |
stderr(message) |
sub |
Subtracts the second value from the first value. | value1, value2 |
sub(value1, value2) |
sum_by |
Sums elements of an array after applying a transformation function. | arr, f |
sum_by(arr, f) |
take |
Takes the first n elements of an array | arr, n |
take(arr, n) |
take_while |
Takes elements from the beginning of an array while the provided function returns true | arr, f |
take_while(arr, f) |
tap |
Applies a function to a value and returns the value (useful for debugging or side effects). | tap_value, tap_expr |
tap(tap_value, tap_expr) |
test |
Tests if string matches a pattern | s, pattern |
test(s, pattern) |
times |
Executes an expression n times and returns an array of results. | t_n, t_expr |
times(t_n, t_expr) |
to_array |
Converts the given value to an array. | value |
to_array(value) |
to_code |
Creates a markdown code block with the given value and language. | value, language |
to_code(value, language) |
to_code_inline |
Creates an inline markdown code node with the given value. | value |
to_code_inline(value) |
to_date |
Converts a timestamp to a date string with the given format. | timestamp, format |
to_date(timestamp, format) |
to_date_iso8601 |
Formats a date to ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) | d |
to_date_iso8601(d) |
to_em |
Creates a markdown emphasis (italic) node with the given value. | value |
to_em(value) |
to_h |
Creates a markdown heading node with the given value and depth. | value, depth |
to_h(value, depth) |
to_hr |
Creates a markdown horizontal rule node. | to_hr() |
|
to_html |
Converts the given markdown string to HTML. | markdown |
to_html(markdown) |
to_image |
Creates a markdown image node with the given URL, alt text, and title. | url, alt, title |
to_image(url, alt, title) |
to_link |
Creates a markdown link node with the given url and title. | url, value, title |
to_link(url, value, title) |
to_markdown |
Parses a markdown string and returns an array of markdown nodes. | markdown_string |
to_markdown(markdown_string) |
to_markdown_string |
Converts the given value(s) to a markdown string representation. | value |
to_markdown_string(value) |
to_math |
Creates a markdown math block with the given value. | value |
to_math(value) |
to_math_inline |
Creates an inline markdown math node with the given value. | value |
to_math_inline(value) |
to_md_list |
Creates a markdown list node with the given value and indent level. | value, indent |
to_md_list(value, indent) |
to_md_name |
Returns the name of the given markdown node. | markdown |
to_md_name(markdown) |
to_md_table_cell |
Creates a markdown table cell node with the given value at the specified row and column. | value, row, column |
to_md_table_cell(value, row, column) |
to_md_table_row |
Creates a markdown table row node with the given values. | cells |
to_md_table_row(cells) |
to_md_text |
Creates a markdown text node with the given value. | value |
to_md_text(value) |
to_mdx |
Parses an MDX string and returns an array of MDX nodes. | mdx_string |
to_mdx(mdx_string) |
to_number |
Converts the given value to a number. | value |
to_number(value) |
to_string |
Converts the given value to a string. | value |
to_string(value) |
to_strong |
Creates a markdown strong (bold) node with the given value. | value |
to_strong(value) |
to_text |
Converts the given markdown node to plain text. | markdown |
to_text(markdown) |
transpose |
Transposes a 2D array (matrix), swapping rows and columns. | matrix |
transpose(matrix) |
trim |
Trims whitespace from both ends of the given string. | input |
trim(input) |
trunc |
Truncates the given number to an integer by removing the fractional part. | number |
trunc(number) |
type |
Returns the type of the given value. | value |
type(value) |
uniq |
Removes duplicate elements from the given array. | array |
uniq(array) |
unique_by |
Returns a new array with duplicate elements removed, comparing by the result of the provided function. | arr, f |
unique_by(arr, f) |
unless |
Executes the expression only if the condition is false. | unless_cond, unless_expr |
unless(unless_cond, unless_expr) |
until |
Executes the expression repeatedly until the condition is true. | until_cond, until_expr |
until(until_cond, until_expr) |
upcase |
Converts the given string to uppercase. | input |
upcase(input) |
update |
Update the value with specified value. | target_value, source_value |
update(target_value, source_value) |
url_encode |
URL-encodes the given string. | input |
url_encode(input) |
values |
Returns an array of values from the dict. | dict |
values(dict) |
handle_string_char |
char, escaped, pos |
handle_string_char(char, escaped, pos) |
|
json_parse |
Parses a JSON string and returns the corresponding data structure. | input |
json_parse(input) |
json_stringify |
Serializes a value to a JSON string. | data |
json_stringify(data) |
json_to_markdown_table |
Converts a JSON data structure to a Markdown table. | data |
json_to_markdown_table(data) |
parse_object |
input |
parse_object(input) |
|
csv_needs_quote |
field, delimiter |
csv_needs_quote(field, delimiter) |
|
csv_parse |
Parses CSV content using a comma as the delimiter. | input, has_header |
csv_parse(input, has_header) |
csv_parse_with_delimiter |
Parses CSV content with a specified delimiter and optional header row. | input, delimiter, has_header |
csv_parse_with_delimiter(input, delimiter, has_header) |
csv_stringify |
Converts data to a CSV string with a specified delimiter. | data, delimiter |
csv_stringify(data, delimiter) |
csv_to_json |
Converts CSV data to a JSON string. | data |
csv_to_json(data) |
csv_to_markdown_table |
Converts CSV data to a Markdown table format. | data |
csv_to_markdown_table(data) |
psv_parse |
Parses PSV (Pipe-Separated Values) content. | input, has_header |
psv_parse(input, has_header) |
tsv_parse |
Parses TSV (Tab-Separated Values) content. | input, has_header |
tsv_parse(input, has_header) |
all_nodes |
Returns all nodes of a section, including both the header and content. | section |
all_nodes(section) |
collect |
Flattens sections back to markdown nodes for output. This converts section objects back to their original markdown node arrays. Deprecated: use `flatten` instead. | sections |
collect(sections) |
content |
Returns the content of a section (all nodes except the header). | section |
content(section) |
filter_sections |
Filters sections based on a given predicate function. | md_nodes, predicate |
filter_sections(md_nodes, predicate) |
flatten |
Flattens sections back to markdown nodes for output. This converts section objects back to their original markdown node arrays. | sections |
flatten(sections) |
has_content |
Checks if a section has any content beyond the header. | section |
has_content(section) |
level |
Returns the header level (1-6) of a section. | section |
level(section) |
map_sections |
Maps sections using a given mapper function. | md_nodes, mapper |
map_sections(md_nodes, mapper) |
nth |
Returns the nth section from an array of sections (0-indexed). | sections, n |
nth(sections, n) |
section |
Returns sections whose title contains the specified pattern. | md_nodes, pattern |
section(md_nodes, pattern) |
sections |
Splits markdown nodes into sections based on headers. | md_nodes |
sections(md_nodes) |
split |
Returns an array of sections, each section is an array of markdown nodes between the specified header and the next header of the same level. | md_nodes, level |
split(md_nodes, level) |
title |
Returns the title text of a section (header text without the # symbols). | section |
title(section) |
title_contains |
Filters the given list of sections, returning only those whose title contains the specified text. | sections, text |
title_contains(sections, text) |
title_match |
Filters sections by a pattern match in the title text. | sections, pattern |
title_match(sections, pattern) |
titles |
Extracts titles from all sections. | sections |
titles(sections) |
toc |
Generates a table of contents from sections. | sections |
toc(sections) |
toml_parse |
Parses a TOML string and returns the parsed data structure. | input |
toml_parse(input) |
toml_stringify |
Converts a data structure to a TOML string representation. | data |
toml_stringify(data) |
toml_to_json |
Converts a data structure to a JSON string representation. | data |
toml_to_json(data) |
toml_to_markdown_table |
Converts a TOML data structure to a Markdown table. | data |
toml_to_markdown_table(data) |
handle_empty_or_comment_line |
lines, current_index, current_indent |
handle_empty_or_comment_line(lines, current_index, current_indent) |
|
is_digit |
Based on YAML 1.2 specification | char |
is_digit(char) |
parse_yaml_content |
input |
parse_yaml_content(input) |
|
parse_yaml_lines |
lines, current_index, current_indent |
parse_yaml_lines(lines, current_index, current_indent) |
|
parse_yaml_lines_with_options |
lines, current_index, current_indent, is_multi_line |
parse_yaml_lines_with_options(lines, current_index, current_indent, is_multi_line) |
|
yaml_parse |
Parses a YAML string and returns the parsed data structure. | input |
yaml_parse(input) |
yaml_stringify |
Converts a data structure to a YAML string representation. | data |
yaml_stringify(data) |
yaml_to_json |
Converts a data structure to a JSON string representation. | data |
yaml_to_json(data) |
yaml_to_markdown_table |
Converts a YAML data structure to a Markdown table. | data |
yaml_to_markdown_table(data) |
xml_parse |
Parses an XML string and returns the corresponding data structure. | input |
xml_parse(input) |
xml_stringify |
Serializes a value to an XML string. | data |
xml_stringify(data) |
xml_to_markdown_table |
Converts an XML data structure to a Markdown table. | data |
xml_to_markdown_table(data) |
fuzzy_best_match |
Finds the best fuzzy match from candidates. | candidates, query |
fuzzy_best_match(candidates, query) |
fuzzy_filter |
Filters candidates by minimum fuzzy match score using Jaro-Winkler. | candidates, query, threshold |
fuzzy_filter(candidates, query, threshold) |
fuzzy_match |
Performs fuzzy matching on an array of strings using Jaro-Winkler distance. | candidates, query |
fuzzy_match(candidates, query) |
fuzzy_match_jaro |
Performs fuzzy matching using Jaro distance. | candidates, query |
fuzzy_match_jaro(candidates, query) |
fuzzy_match_levenshtein |
Performs fuzzy matching using Levenshtein distance. | candidates, query |
fuzzy_match_levenshtein(candidates, query) |
jaro |
Calculates the Jaro distance between two strings (0.0 to 1.0, where 1.0 is exact match). | s1, s2 |
jaro(s1, s2) |
jaro_winkler |
Calculates the Jaro-Winkler distance between two strings. | s1, s2 |
jaro_winkler(s1, s2) |
levenshtein |
Calculates the Levenshtein distance between two strings. | s1, s2 |
levenshtein(s1, s2) |
add_column |
Add a new column to a table. | table, col |
add_column(table, col) |
add_row |
Add a new row to a table. | table, row |
add_row(table, row) |
filter_rows |
Filter rows in the table based on a predicate function. | table, f |
filter_rows(table, f) |
filter_tables |
Filter tables from markdown nodes based on a predicate function. | tables, f |
filter_tables(tables, f) |
map_rows |
Map a function over each row in the table. | table, f |
map_rows(table, f) |
remove_column |
Remove a column from a table at the specified index. | table, col_index |
remove_column(table, col_index) |
remove_row |
Remove a row from a table at the specified index. | table, row_index |
remove_row(table, row_index) |
set_align |
Set the alignment for a table. | table, align |
set_align(table, align) |
sort_rows |
Sort rows in the table by a specified column index or default sorting. | table, column_index |
sort_rows(table, column_index) |
tables |
Extract table structures from a list of markdown nodes. | md_nodes |
tables(md_nodes) |
to_csv |
Convert a table structure into a CSV string with the specified delimiter. | table, delimiter |
to_csv(table, delimiter) |
to_markdown |
Convert a table structure back into a list of markdown nodes. | table |
to_markdown(table) |
210 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
abs |
Returns the absolute value of the given number. | number |
abs(number) |
add |
Adds two values. | value1, value2 |
add(value1, value2) |
all |
Returns true if all element in the array satisfies the provided function. | v, f |
all(v, f) |
all_symbols |
Returns an array of all interned symbols. | all_symbols() |
|
and |
Performs a logical AND operation on two boolean values. | value1, value2 |
and(value1, value2) |
any |
Returns true if any element in the array satisfies the provided function. | v, f |
any(v, f) |
array |
Creates an array from the given values. | values |
array(values) |
arrays |
Returns array if input is array, None otherwise | a |
arrays(a) |
assert |
Asserts that two values are equal, returns the value if true, otherwise raises an error. | value1, value2 |
assert(value1, value2) |
attr |
Retrieves the value of the specified attribute from a markdown node. | markdown, attribute |
attr(markdown, attribute) |
base64 |
Encodes the given string to base64. | input |
base64(input) |
base64d |
Decodes the given base64 string. | input |
base64d(input) |
base64url |
Encodes the given string to URL-safe base64. | input |
base64url(input) |
base64urld |
Decodes the given URL-safe base64 string. | input |
base64urld(input) |
between |
Checks if a value is between min and max (inclusive). | value, min, max |
between(value, min, max) |
booleans |
Returns boolean if input is boolean, None otherwise | b |
booleans(b) |
breakpoint |
Sets a breakpoint for debugging; execution will pause at this point if a debugger is attached. | breakpoint() |
|
bsearch |
Performs a binary search on a sorted array to find the index of the target value. | arr, target |
bsearch(arr, target) |
capture |
Captures named groups from the given string based on the specified regular expression pattern and returns them as a dictionary keyed by group names. | string, pattern |
capture(string, pattern) |
ceil |
Rounds the given number up to the nearest integer. | number |
ceil(number) |
coalesce |
Returns the first non-None value from the two provided arguments. | value1, value2 |
coalesce(value1, value2) |
compact |
Removes None values from the given array. | array |
compact(array) |
compact_map |
Maps over an array and removes None values from the result. | arr, f |
compact_map(arr, f) |
contains |
Checks if string contains a substring | haystack, needle |
contains(haystack, needle) |
convert |
Converts the input value to the specified format. Supported formats: base64, html, text, uri, heading (#, ##, etc.), blockquote (>), list item (-), or link (URL). | input, format |
convert(input, format) |
count_by |
Returns the count of elements in the array that satisfy the provided function. | arr, f |
count_by(arr, f) |
debug |
Prints the debug information of the given value(s). | args |
debug(args) |
decrease_header_depth |
Decreases the depth (numeric level) of a markdown heading node by one, effectively promoting the heading (e.g. h2 -> h1), down to a minimum of 1. | node |
decrease_header_depth(node) |
decrease_header_level |
Deprecated: use `decrease_header_depth` or `promote_heading` instead. Kept for backward compatibility; behavior unchanged. | node |
decrease_header_level(node) |
del |
Deletes the element at the specified index in the array or string. | array_or_string, index |
del(array_or_string, index) |
demote_heading |
Demotes a markdown heading by increasing its depth (numeric level) by one. This is an alias for `increase_header_depth`. | node |
demote_heading(node) |
dict |
Creates a new, empty dict. | dict() |
|
div |
Divides the first value by the second value. | value1, value2 |
div(value1, value2) |
downcase |
Converts the given string to lowercase. | input |
downcase(input) |
each |
Executes a provided function once for each element in an array or each key-value pair in a dictionary. | v, f |
each(v, f) |
ends_with |
Checks if the given string ends with the specified substring. | string, substring |
ends_with(string, substring) |
entries |
Returns an array of key-value pairs from the dict as arrays. | dict |
entries(dict) |
eq |
Checks if two values are equal. | value1, value2 |
eq(value1, value2) |
error |
Raises a user-defined error with the specified message. | message |
error(message) |
explode |
Splits the given string into an array of characters. | string |
explode(string) |
fill |
Returns an array of length n filled with the given value. | value, n |
fill(value, n) |
filter |
Filters the elements of an array based on a provided callback function. | v, f |
filter(v, f) |
find_index |
Returns the index of the first element in an array that satisfies the provided function. | arr, f |
find_index(arr, f) |
first |
Returns the first element of an array | arr |
first(arr) |
flat_map |
Applies a function to each element and flattens the result into a single array | v, f |
flat_map(v, f) |
flatten |
Flattens a nested array into a single level array. | array |
flatten(array) |
floor |
Rounds the given number down to the nearest integer. | number |
floor(number) |
fold |
Reduces an array to a single value by applying a function, starting from an initial value. | arr, init, f |
fold(arr, init, f) |
from_date |
Converts a date string to a timestamp. | date_str |
from_date(date_str) |
get |
Retrieves a value from a dict by its key. Returns None if the key is not found. | obj, key |
get(obj, key) |
get_or |
Safely gets a value from a dict with a default if the key doesn't exist. | dict, key, default |
get_or(dict, key, default) |
get_title |
Returns the title of a markdown node. | node |
get_title(node) |
get_url |
Returns the url of a markdown node. | node |
get_url(node) |
get_variable |
Retrieves the value of a symbol or variable from the current environment. | symbol_or_string |
get_variable(symbol_or_string) |
group_by |
Groups elements of an array by the result of applying a function to each element | arr, f |
group_by(arr, f) |
gsub |
Replaces all occurrences matching a regular expression pattern with the replacement string. | from, pattern, to |
gsub(from, pattern, to) |
gt |
Checks if the first value is greater than the second value. | value1, value2 |
gt(value1, value2) |
gte |
Checks if the first value is greater than or equal to the second value. | value1, value2 |
gte(value1, value2) |
halt |
Terminates the program with the given exit code. | exit_code |
halt(exit_code) |
halt_error |
Halts execution with error code 5 | halt_error() |
|
identity |
Returns the input value unchanged. | x |
identity(x) |
implode |
Joins an array of characters into a string. | array |
implode(array) |
in |
Returns true if the element is in the array. | v, elem |
in(v, elem) |
increase_header_depth |
Increases the depth (numeric level) of a markdown heading node by one, effectively demoting the heading (e.g. h1 -> h2), up to a maximum of 6. | node |
increase_header_depth(node) |
increase_header_level |
Deprecated: use `increase_header_depth` or `demote_heading` instead. Kept for backward compatibility; behavior unchanged. | node |
increase_header_level(node) |
index |
Finds the first occurrence of a substring in the given string. | string, substring |
index(string, substring) |
index_by |
Creates a dictionary indexed by a key extracted from each element. | arr, f |
index_by(arr, f) |
infinite |
Returns an infinite number value. | infinite() |
|
input |
Reads a line from standard input and returns it as a string. | input() |
|
insert |
Inserts a value into an array or string at the specified index, or into a dict with the specified key. | target, index_or_key, value |
insert(target, index_or_key, value) |
inspect |
Inspects a value by printing its string representation and returning the value. | value |
inspect(value) |
intern |
Interns the given string, returning a canonical reference for efficient comparison. | string |
intern(string) |
is_array |
Checks if input is an array | a |
is_array(a) |
is_bool |
Checks if input is a boolean | b |
is_bool(b) |
is_code |
Checks if markdown is code block | md |
is_code(md) |
is_debug_mode |
Checks if the runtime is currently in debug mode, returning true if a debugger is attached. | is_debug_mode() |
|
is_dict |
Checks if input is a dictionary | d |
is_dict(d) |
is_em |
Checks if markdown is emphasis | md |
is_em(md) |
is_empty |
Checks if string, array or dict is empty | s |
is_empty(s) |
is_h |
Checks if markdown is heading | md |
is_h(md) |
is_h1 |
Checks if markdown is h1 heading | md |
is_h1(md) |
is_h2 |
Checks if markdown is h2 heading | md |
is_h2(md) |
is_h3 |
Checks if markdown is h3 heading | md |
is_h3(md) |
is_h4 |
Checks if markdown is h4 heading | md |
is_h4(md) |
is_h5 |
Checks if markdown is h5 heading | md |
is_h5(md) |
is_h6 |
Checks if markdown is h6 heading | md |
is_h6(md) |
is_h_level |
Checks if markdown is a heading of the specified level (1-6) | md, level |
is_h_level(md, level) |
is_html |
Checks if markdown is html | md |
is_html(md) |
is_list |
Checks if markdown is list | list |
is_list(list) |
is_markdown |
Checks if input is markdown | m |
is_markdown(m) |
is_mdx |
Checks if markdown is MDX | mdx |
is_mdx(mdx) |
is_mdx_flow_expression |
Checks if markdown is MDX Flow Expression | mdx |
is_mdx_flow_expression(mdx) |
is_mdx_js_esm |
Checks if markdown is MDX Js Esm | mdx |
is_mdx_js_esm(mdx) |
is_mdx_jsx_flow_element |
Checks if markdown is MDX Jsx Flow Element | mdx |
is_mdx_jsx_flow_element(mdx) |
is_mdx_jsx_text_element |
Checks if markdown is MDX Jsx Text Element | mdx |
is_mdx_jsx_text_element(mdx) |
is_mdx_text_expression |
Checks if markdown is MDX Text Expression | mdx |
is_mdx_text_expression(mdx) |
is_none |
Checks if input is None | n |
is_none(n) |
is_number |
Checks if input is a number | n |
is_number(n) |
is_regex_match |
Checks if the given pattern matches the string. | string, pattern |
is_regex_match(string, pattern) |
is_string |
Checks if input is a string | s |
is_string(s) |
is_table_align |
Checks if markdown is table align | md |
is_table_align(md) |
is_table_cell |
Checks if markdown is table cell | md |
is_table_cell(md) |
is_text |
Checks if markdown is text | text |
is_text(text) |
is_toml |
Checks if markdown is toml | md |
is_toml(md) |
is_yaml |
Checks if markdown is yaml | md |
is_yaml(md) |
join |
Joins the elements of an array into a string with the given separator. | array, separator |
join(array, separator) |
keys |
Returns an array of keys from the dict. | dict |
keys(dict) |
last |
Returns the last element of an array | arr |
last(arr) |
len |
Returns the length of the given string or array. | value |
len(value) |
load_markdown |
Loads a markdown file from the specified path | path |
load_markdown(path) |
lpad |
Left-pads a string to a specified length using a given padding string. | s, length, pad_str |
lpad(s, length, pad_str) |
lt |
Checks if the first value is less than the second value. | value1, value2 |
lt(value1, value2) |
lte |
Checks if the first value is less than or equal to the second value. | value1, value2 |
lte(value1, value2) |
ltrim |
Trims whitespace from the left end of the given string. | input |
ltrim(input) |
ltrimstr |
Removes prefix string from input if it exists | s, left |
ltrimstr(s, left) |
map |
Applies a given function to each element of the provided array and returns a new array with the results. | v, f |
map(v, f) |
markdowns |
Returns markdown if input is markdown, None otherwise | m |
markdowns(m) |
matches_url |
Checks if markdown node's URL matches a specified URL deprecated: use select(.link.url == url) instead | node, url |
matches_url(node, url) |
max |
Returns the maximum of two values. | value1, value2 |
max(value1, value2) |
min |
Returns the minimum of two values. | value1, value2 |
min(value1, value2) |
mod |
Calculates the remainder of the division of the first value by the second value. | value1, value2 |
mod(value1, value2) |
mul |
Multiplies two values. | value1, value2 |
mul(value1, value2) |
nan |
Returns a Not-a-Number (NaN) value. | nan() |
|
ne |
Checks if two values are not equal. | value1, value2 |
ne(value1, value2) |
negate |
Returns the negation of the given number. | number |
negate(number) |
not |
Performs a logical NOT operation on a boolean value. | value |
not(value) |
now |
Returns the current timestamp. | now() |
|
numbers |
Returns number if input is number, None otherwise | n |
numbers(n) |
or |
Performs a logical OR operation on two boolean values. | value1, value2 |
or(value1, value2) |
partition |
Splits an array into two arrays: [matching, not_matching] based on a condition. | arr, f |
partition(arr, f) |
pluck |
Extracts values from an array of objects based on a specified selector. | pluck_obj, selector |
pluck(pluck_obj, selector) |
pow |
Raises the base to the power of the exponent. | base, exponent |
pow(base, exponent) |
print |
Prints a message to standard output and returns the current value. | message |
print(message) |
promote_heading |
Promotes a markdown heading by decreasing its depth (numeric level) by one. This is an alias for `decrease_header_depth`. | node |
promote_heading(node) |
range |
Creates an array from start to end with an optional step. | start, end, step |
range(start, end, step) |
read_file |
Reads the contents of a file at the given path and returns it as a string. | path |
read_file(path) |
regex_match |
Finds all matches of the given pattern in the string. | string, pattern |
regex_match(string, pattern) |
reject |
Filters out elements that match the condition (opposite of filter). | arr, f |
reject(arr, f) |
repeat |
Repeats the given string a specified number of times. | string, count |
repeat(string, count) |
replace |
Replaces all occurrences of a substring with another substring. | from, pattern, to |
replace(from, pattern, to) |
reverse |
Reverses the given string or array. | value |
reverse(value) |
rindex |
Finds the last occurrence of a substring in the given string. | string, substring |
rindex(string, substring) |
round |
Rounds the given number to the nearest integer. | number |
round(number) |
rpad |
Right-pads a string to a specified length using a given padding string. | s, length, pad_str |
rpad(s, length, pad_str) |
rtrim |
Trims whitespace from the right end of the given string. | input |
rtrim(input) |
rtrimstr |
Removes suffix string from input if it exists | s, right |
rtrimstr(s, right) |
second |
Returns the second element of an array | arr |
second(arr) |
select |
Returns value if condition is true, None otherwise | v, f |
select(v, f) |
set |
Sets a key-value pair in a dict. If the key exists, its value is updated. Returns the modified map. | obj, key, value |
set(obj, key, value) |
set_attr |
Sets the value of the specified attribute on a markdown node. | markdown, attribute, value |
set_attr(markdown, attribute, value) |
set_check |
Creates a markdown list node with the given checked state. | list, checked |
set_check(list, checked) |
set_code_block_lang |
Sets the language of a markdown code block node. | code_block, language |
set_code_block_lang(code_block, language) |
set_list_ordered |
Sets the ordered property of a markdown list node. | list, ordered |
set_list_ordered(list, ordered) |
set_ref |
Sets the reference identifier for markdown nodes that support references (e.g., Definition, LinkRef, ImageRef, Footnote, FootnoteRef). | node, reference_id |
set_ref(node, reference_id) |
set_variable |
Sets a symbol or variable in the current environment with the given value. | symbol_or_string, value |
set_variable(symbol_or_string, value) |
shift_left |
Performs a left shift operation on the given value: for numbers, this is a bitwise left shift by the specified number of positions; for strings, this removes characters from the start; for Markdown headings, this increases the heading level accordingly. | value, shift_amount |
shift_left(value, shift_amount) |
shift_right |
Performs a bitwise right shift on numbers, slices characters from the end of strings, and adjusts Markdown heading levels when applied to headings, using the given shift amount. | value, shift_amount |
shift_right(value, shift_amount) |
skip |
Skips the first n elements of an array and returns the rest | arr, n |
skip(arr, n) |
skip_while |
Skips elements from the beginning of an array while the provided function returns true | arr, f |
skip_while(arr, f) |
slice |
Extracts a substring from the given string. | string, start, end |
slice(string, start, end) |
slugify |
Converts a string into a URL-friendly slug by lowercasing, replacing non-alphanumeric characters with hyphens, and trimming hyphens from the ends. | s, separator |
slugify(s, separator) |
sort |
Sorts the elements of the given array. | array |
sort(array) |
sort_by |
Sorts an array using a key function that extracts a comparable value for each element. | arr, f |
sort_by(arr, f) |
split |
Splits the given string by the specified separator. | string, separator |
split(string, separator) |
starts_with |
Checks if the given string starts with the specified substring. | string, substring |
starts_with(string, substring) |
stderr |
Prints a message to standard error and returns the current value. | message |
stderr(message) |
sub |
Subtracts the second value from the first value. | value1, value2 |
sub(value1, value2) |
sum_by |
Sums elements of an array after applying a transformation function. | arr, f |
sum_by(arr, f) |
take |
Takes the first n elements of an array | arr, n |
take(arr, n) |
take_while |
Takes elements from the beginning of an array while the provided function returns true | arr, f |
take_while(arr, f) |
tap |
Applies a function to a value and returns the value (useful for debugging or side effects). | tap_value, tap_expr |
tap(tap_value, tap_expr) |
test |
Tests if string matches a pattern | s, pattern |
test(s, pattern) |
times |
Executes an expression n times and returns an array of results. | t_n, t_expr |
times(t_n, t_expr) |
to_array |
Converts the given value to an array. | value |
to_array(value) |
to_code |
Creates a markdown code block with the given value and language. | value, language |
to_code(value, language) |
to_code_inline |
Creates an inline markdown code node with the given value. | value |
to_code_inline(value) |
to_date |
Converts a timestamp to a date string with the given format. | timestamp, format |
to_date(timestamp, format) |
to_date_iso8601 |
Formats a date to ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) | d |
to_date_iso8601(d) |
to_em |
Creates a markdown emphasis (italic) node with the given value. | value |
to_em(value) |
to_h |
Creates a markdown heading node with the given value and depth. | value, depth |
to_h(value, depth) |
to_hr |
Creates a markdown horizontal rule node. | to_hr() |
|
to_html |
Converts the given markdown string to HTML. | markdown |
to_html(markdown) |
to_image |
Creates a markdown image node with the given URL, alt text, and title. | url, alt, title |
to_image(url, alt, title) |
to_link |
Creates a markdown link node with the given url and title. | url, value, title |
to_link(url, value, title) |
to_markdown |
Parses a markdown string and returns an array of markdown nodes. | markdown_string |
to_markdown(markdown_string) |
to_markdown_string |
Converts the given value(s) to a markdown string representation. | value |
to_markdown_string(value) |
to_math |
Creates a markdown math block with the given value. | value |
to_math(value) |
to_math_inline |
Creates an inline markdown math node with the given value. | value |
to_math_inline(value) |
to_md_list |
Creates a markdown list node with the given value and indent level. | value, indent |
to_md_list(value, indent) |
to_md_name |
Returns the name of the given markdown node. | markdown |
to_md_name(markdown) |
to_md_table_cell |
Creates a markdown table cell node with the given value at the specified row and column. | value, row, column |
to_md_table_cell(value, row, column) |
to_md_table_row |
Creates a markdown table row node with the given values. | cells |
to_md_table_row(cells) |
to_md_text |
Creates a markdown text node with the given value. | value |
to_md_text(value) |
to_mdx |
Parses an MDX string and returns an array of MDX nodes. | mdx_string |
to_mdx(mdx_string) |
to_number |
Converts the given value to a number. | value |
to_number(value) |
to_string |
Converts the given value to a string. | value |
to_string(value) |
to_strong |
Creates a markdown strong (bold) node with the given value. | value |
to_strong(value) |
to_text |
Converts the given markdown node to plain text. | markdown |
to_text(markdown) |
transpose |
Transposes a 2D array (matrix), swapping rows and columns. | matrix |
transpose(matrix) |
trim |
Trims whitespace from both ends of the given string. | input |
trim(input) |
trunc |
Truncates the given number to an integer by removing the fractional part. | number |
trunc(number) |
type |
Returns the type of the given value. | value |
type(value) |
uniq |
Removes duplicate elements from the given array. | array |
uniq(array) |
unique_by |
Returns a new array with duplicate elements removed, comparing by the result of the provided function. | arr, f |
unique_by(arr, f) |
unless |
Executes the expression only if the condition is false. | unless_cond, unless_expr |
unless(unless_cond, unless_expr) |
until |
Executes the expression repeatedly until the condition is true. | until_cond, until_expr |
until(until_cond, until_expr) |
upcase |
Converts the given string to uppercase. | input |
upcase(input) |
update |
Update the value with specified value. | target_value, source_value |
update(target_value, source_value) |
url_encode |
URL-encodes the given string. | input |
url_encode(input) |
values |
Returns an array of values from the dict. | dict |
values(dict) |
5 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
handle_string_char |
char, escaped, pos |
handle_string_char(char, escaped, pos) |
|
json_parse |
Parses a JSON string and returns the corresponding data structure. | input |
json_parse(input) |
json_stringify |
Serializes a value to a JSON string. | data |
json_stringify(data) |
json_to_markdown_table |
Converts a JSON data structure to a Markdown table. | data |
json_to_markdown_table(data) |
parse_object |
input |
parse_object(input) |
8 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
csv_needs_quote |
field, delimiter |
csv_needs_quote(field, delimiter) |
|
csv_parse |
Parses CSV content using a comma as the delimiter. | input, has_header |
csv_parse(input, has_header) |
csv_parse_with_delimiter |
Parses CSV content with a specified delimiter and optional header row. | input, delimiter, has_header |
csv_parse_with_delimiter(input, delimiter, has_header) |
csv_stringify |
Converts data to a CSV string with a specified delimiter. | data, delimiter |
csv_stringify(data, delimiter) |
csv_to_json |
Converts CSV data to a JSON string. | data |
csv_to_json(data) |
csv_to_markdown_table |
Converts CSV data to a Markdown table format. | data |
csv_to_markdown_table(data) |
psv_parse |
Parses PSV (Pipe-Separated Values) content. | input, has_header |
psv_parse(input, has_header) |
tsv_parse |
Parses TSV (Tab-Separated Values) content. | input, has_header |
tsv_parse(input, has_header) |
17 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
all_nodes |
Returns all nodes of a section, including both the header and content. | section |
all_nodes(section) |
collect |
Flattens sections back to markdown nodes for output. This converts section objects back to their original markdown node arrays. Deprecated: use `flatten` instead. | sections |
collect(sections) |
content |
Returns the content of a section (all nodes except the header). | section |
content(section) |
filter_sections |
Filters sections based on a given predicate function. | md_nodes, predicate |
filter_sections(md_nodes, predicate) |
flatten |
Flattens sections back to markdown nodes for output. This converts section objects back to their original markdown node arrays. | sections |
flatten(sections) |
has_content |
Checks if a section has any content beyond the header. | section |
has_content(section) |
level |
Returns the header level (1-6) of a section. | section |
level(section) |
map_sections |
Maps sections using a given mapper function. | md_nodes, mapper |
map_sections(md_nodes, mapper) |
nth |
Returns the nth section from an array of sections (0-indexed). | sections, n |
nth(sections, n) |
section |
Returns sections whose title contains the specified pattern. | md_nodes, pattern |
section(md_nodes, pattern) |
sections |
Splits markdown nodes into sections based on headers. | md_nodes |
sections(md_nodes) |
split |
Returns an array of sections, each section is an array of markdown nodes between the specified header and the next header of the same level. | md_nodes, level |
split(md_nodes, level) |
title |
Returns the title text of a section (header text without the # symbols). | section |
title(section) |
title_contains |
Filters the given list of sections, returning only those whose title contains the specified text. | sections, text |
title_contains(sections, text) |
title_match |
Filters sections by a pattern match in the title text. | sections, pattern |
title_match(sections, pattern) |
titles |
Extracts titles from all sections. | sections |
titles(sections) |
toc |
Generates a table of contents from sections. | sections |
toc(sections) |
4 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
toml_parse |
Parses a TOML string and returns the parsed data structure. | input |
toml_parse(input) |
toml_stringify |
Converts a data structure to a TOML string representation. | data |
toml_stringify(data) |
toml_to_json |
Converts a data structure to a JSON string representation. | data |
toml_to_json(data) |
toml_to_markdown_table |
Converts a TOML data structure to a Markdown table. | data |
toml_to_markdown_table(data) |
9 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
handle_empty_or_comment_line |
lines, current_index, current_indent |
handle_empty_or_comment_line(lines, current_index, current_indent) |
|
is_digit |
Based on YAML 1.2 specification | char |
is_digit(char) |
parse_yaml_content |
input |
parse_yaml_content(input) |
|
parse_yaml_lines |
lines, current_index, current_indent |
parse_yaml_lines(lines, current_index, current_indent) |
|
parse_yaml_lines_with_options |
lines, current_index, current_indent, is_multi_line |
parse_yaml_lines_with_options(lines, current_index, current_indent, is_multi_line) |
|
yaml_parse |
Parses a YAML string and returns the parsed data structure. | input |
yaml_parse(input) |
yaml_stringify |
Converts a data structure to a YAML string representation. | data |
yaml_stringify(data) |
yaml_to_json |
Converts a data structure to a JSON string representation. | data |
yaml_to_json(data) |
yaml_to_markdown_table |
Converts a YAML data structure to a Markdown table. | data |
yaml_to_markdown_table(data) |
3 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
xml_parse |
Parses an XML string and returns the corresponding data structure. | input |
xml_parse(input) |
xml_stringify |
Serializes a value to an XML string. | data |
xml_stringify(data) |
xml_to_markdown_table |
Converts an XML data structure to a Markdown table. | data |
xml_to_markdown_table(data) |
8 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
fuzzy_best_match |
Finds the best fuzzy match from candidates. | candidates, query |
fuzzy_best_match(candidates, query) |
fuzzy_filter |
Filters candidates by minimum fuzzy match score using Jaro-Winkler. | candidates, query, threshold |
fuzzy_filter(candidates, query, threshold) |
fuzzy_match |
Performs fuzzy matching on an array of strings using Jaro-Winkler distance. | candidates, query |
fuzzy_match(candidates, query) |
fuzzy_match_jaro |
Performs fuzzy matching using Jaro distance. | candidates, query |
fuzzy_match_jaro(candidates, query) |
fuzzy_match_levenshtein |
Performs fuzzy matching using Levenshtein distance. | candidates, query |
fuzzy_match_levenshtein(candidates, query) |
jaro |
Calculates the Jaro distance between two strings (0.0 to 1.0, where 1.0 is exact match). | s1, s2 |
jaro(s1, s2) |
jaro_winkler |
Calculates the Jaro-Winkler distance between two strings. | s1, s2 |
jaro_winkler(s1, s2) |
levenshtein |
Calculates the Levenshtein distance between two strings. | s1, s2 |
levenshtein(s1, s2) |
12 functions
| Function | Description | Parameters | Example |
|---|---|---|---|
add_column |
Add a new column to a table. | table, col |
add_column(table, col) |
add_row |
Add a new row to a table. | table, row |
add_row(table, row) |
filter_rows |
Filter rows in the table based on a predicate function. | table, f |
filter_rows(table, f) |
filter_tables |
Filter tables from markdown nodes based on a predicate function. | tables, f |
filter_tables(tables, f) |
map_rows |
Map a function over each row in the table. | table, f |
map_rows(table, f) |
remove_column |
Remove a column from a table at the specified index. | table, col_index |
remove_column(table, col_index) |
remove_row |
Remove a row from a table at the specified index. | table, row_index |
remove_row(table, row_index) |
set_align |
Set the alignment for a table. | table, align |
set_align(table, align) |
sort_rows |
Sort rows in the table by a specified column index or default sorting. | table, column_index |
sort_rows(table, column_index) |
tables |
Extract table structures from a list of markdown nodes. | md_nodes |
tables(md_nodes) |
to_csv |
Convert a table structure into a CSV string with the specified delimiter. | table, delimiter |
to_csv(table, delimiter) |
to_markdown |
Convert a table structure back into a list of markdown nodes. | table |
to_markdown(table) |
41 selectors
| Selector | Description |
|---|---|
.<> |
Selects an HTML node. |
.[] |
Selects a list node with the specified index and checked state. |
.[][] |
Selects a table cell node with the specified row and column. |
.blockquote |
Selects a blockquote node. |
.break |
Selects a break node. |
.code |
Selects a code block node with the specified language. |
.code_inline |
Selects an inline code node. |
.definition |
Selects a definition node. |
.delete |
Selects a delete (strikethrough) node. |
.emphasis |
Selects an emphasis (italic) node. |
.footnote |
Selects a footnote node. |
.footnote_ref |
Selects a footnote reference node. |
.h |
Selects a heading node with the specified depth. |
.h1 |
Selects a heading node with the 1 depth. |
.h2 |
Selects a heading node with the 2 depth. |
.h3 |
Selects a heading node with the 3 depth. |
.h4 |
Selects a heading node with the 4 depth. |
.h5 |
Selects a heading node with the 5 depth. |
.h6 |
Selects a heading node with the 6 depth. |
.heading |
Selects a heading node with the specified depth. |
.horizontal_rule |
Selects a horizontal rule node. |
.html |
Selects an HTML node. |
.image |
Selects an image node. |
.image_ref |
Selects an image reference node. |
.inline_math |
Selects an inline math node. |
.link |
Selects a link node. |
.link_ref |
Selects a link reference node. |
.list |
Selects a list node with the specified index and checked state. |
.math |
Selects a math node. |
.math_inline |
Selects a math inline node. |
.mdx_flow_expression |
Selects an MDX flow expression node. |
.mdx_js_esm |
Selects an MDX JS ESM node. |
.mdx_jsx_flow_element |
Selects an MDX JSX flow element node. |
.mdx_jsx_text_element |
Selects an MDX JSX text element node. |
.mdx_text_expression |
Selects an MDX text expression node. |
.strong |
Selects a strong (bold) node. |
.table |
Selects a table cell node with the specified row and column. |
.table_align |
Selects a table align node. |
.text |
Selects a text node. |
.toml |
Selects a TOML node. |
.yaml |
Selects a YAML node. |