docs/functions-inner.sql

select 'breadcrumb' as component;
    select 'Home' as title, '/' as link;
    select 'Docs' as title, '/docs/index.sql' as link;
    select 'SQL Functions' as title, '/docs/functions.sql' as link;
    select $function as title, '/docs/functions-inner.sql?function=' || $function AS link;

    SELECT 'text' AS component,
      '' || name || '()' AS title, 'function' AS id
    FROM surveilr_function_doc WHERE name = $function;

    SELECT 'text' AS component,
      description AS contents_md
    FROM surveilr_function_doc WHERE name = $function;

    SELECT 'text' AS component,
      'Introduced in version ' || version || '.' AS contents
    FROM surveilr_function_doc WHERE name = $function;

    SELECT 'title' AS component,
      3 AS level,
      'Parameters' AS contents
    WHERE $function IS NOT NULL;

    SELECT 'card' AS component,
      3 AS columns
      WHERE $function IS NOT NULL;
    SELECT
      json_each.value ->> '$.name' AS title,
      json_each.value ->> '$.description' AS description,
      json_each.value ->> '$.data_type' AS footer,
      'azure' AS color
    FROM surveilr_function_doc, json_each(surveilr_function_doc.parameters)
    WHERE name = $function;

    -- Navigation Buttons
    SELECT 'button' AS component, 'sm' AS size, 'pill' AS shape;
    SELECT name AS title,
      NULL AS icon,
      sqlpage.link('functions-inner.sql', json_object('function', name)) AS link
    FROM surveilr_function_doc
    ORDER BY name;