Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Markdown Math Renderer

markdown.render_math

ProductionEngine wrapper (Class A)Deterministicstrictmoderatev2.0.0
File inputFile outputNo networkTemp storage

Overview

You send Markdown with TeX math and we return sanitized HTML with every expression typeset as SVG. We pick up $...$ and \(...\) inline, $$...$$, \[...\] and ```math fences as display, and we deliberately leave math inside code spans and code fences alone. The result always goes through a safelist sanitizer, so scripts, event handlers and dangerous URLs never reach your page. We render and sanitize — we do not evaluate math, execute LaTeX, or generate PDFs. Do not use this for plotting, Mermaid diagrams, or solving expressions. Choosing between this and markdown.render: use this one when you need the expressions on their own as SVG fragments, the result written to a file, a malformed expression to fail the call rather than degrade to source, or more than 100 expressions in one pass. For rendering a document that merely contains math, markdown.render is the better choice — it typesets with this same engine when you set components.math.mode to auto, and it adds grammars, heading anchors, a table of contents, callouts, an image manifest and a sanitizer report that this skill does not have. Accepts file input via file_ref — no need to extract file content first.

Most downstream systems cannot render TeX natively — you need a deterministic, sanitized rendering layer.

Reliability

STRICT and deterministic for identical input and renderer version when math is present. Depends on the MathJax sidecar — you may see INTERNAL_RENDERER_UNAVAILABLE, RENDERER_BUSY, RENDER_TIMEOUT, MATH_RENDERING_FAILED, TOO_MANY_MATH_EXPRESSIONS, INPUT_TOO_LARGE, UNSUPPORTED_OUTPUT_FORMAT, and SANITIZATION_FAILED. MARKDOWN_INVALID_ENCODING is not retryable unchanged: re-encode the file_ref as valid UTF-8. MARKDOWN_COMPLEXITY_LIMIT is not retryable unchanged: split or simplify a document that exceeds the fixed depth or node cap. Other input validation (not retryable): missing markdown and file_ref, invalid outputFormat or theme, or expression count above maxMathExpressions.

Context footprint

Inline input up to 200000 characters or 500000 bytes via file_ref. Output may exceed input size; results above 100000 bytes can be stored as a downloadable file. A successful call costs 5 execution credits.

When to use it

When you need one of the four things this skill does and markdown.render does not: the expressions on their own as SVG fragments without the prose around them, the result stored as a file instead of returned inline, a malformed expression failing the call outright rather than being preserved as source, or more than 100 expressions in a single document. For rendering a document that happens to contain math, markdown.render is the better default: it typesets with this same engine when components.math.mode is auto, and it adds the grammars, heading anchors, table of contents, callouts, image manifest and sanitizer report this skill has no notion of.

When you need to evaluate math, plot functions, or generate PDFs. Also when the job is really a document rather than its equations — use markdown.render; its math component defaults to auto.

Powered by MathJax for math typesetting, commonmark-java for Markdown parsing, and jsoup for HTML sanitization.

Scope

Note
Renders Markdown containing TeX/LaTeX into sanitized HTML with math as SVG.

Non-goals

  • Does not evaluate or solve math expressions
  • Does not plot functions or generate charts
  • Does not convert Markdown into LaTeX or PDF documents
  • Does not execute arbitrary JavaScript or LaTeX

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

document-processingformatting

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call5 credits

File handling

Accepts file_refProduces file_refMax input195.3 KBMax file size488.3 KB

File limits

Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.

LimitValueLimited by
Maximum size per input file488.3 KiBSkill maximum

How we handle your data

Protected temp storage
What this means

This skill may temporarily store files or intermediate data only to complete execution. Temporary data is protected and automatically deleted.

Squillify guarantees
  • Runs inside Squillify using a self-contained open-source component
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Self contained open source component
  • Temporary execution only storage
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response may contain submitted or transformed content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
markdownstringNoThe Markdown to render, up to 200000 characters. Math is recognized as $...$ or \(...\) inline and $$...$$, \[...\] or a ```math fence as display; anything inside a code span or code fence is left as code. Omit it only when you send file_ref; sending neither is invalid. If both are present, file_ref wins and the conflict is reported in metadata.
file_refstringNoA stored Markdown file (squillify://files/f-...) we read instead of inline text, up to 500000 bytes. Handy for LaTeX, since backslashes need no JSON escaping. Omit it when you send markdown — one of the two is required.
outputFormatstringNoOptional. html_svg (default) and html both return one HTML document with the math inlined as SVG; svg_fragments skips the prose and returns just the rendered expressions, one entry per expression.
outputToFilebooleanNoOptional. Set true to always get the result back as file_ref, download_url and size_bytes rather than inline html. Defaults to false, and we switch to a file on our own once the output passes 100000 bytes.
themestringNoOptional. squillify (default) applies the frozen Squillify Design System presentation; default, scientific-clean, compact, and dark preserve the legacy math wrappers. The value is ignored for svg_fragments.
sanitizeHtmlbooleanNoOptional flag recorded in the response as metadata.sanitized. It cannot switch sanitizing off: we always clean the HTML against our safelist and always clean each MathJax SVG. Defaults to true, and leaving it there keeps the flag honest.
allowRawHtmlbooleanNoOptional. Set true to let HTML written inside your Markdown through the parser — it still has to survive the safelist, so scripts and event handlers are dropped either way. Defaults to false, which escapes that HTML as text.
includeCssbooleanNoOptional. Set false to omit the Squillify theme stylesheet and the sanitized MathJax style block when the host page already ships them. Defaults to true.
profilestringNoOptional shared Markdown profile: commonmark, gfm, or squillify-safe (default).
errorPolicystringNoOptional. preserve_source (default) returns malformed TeX as source with a warning; fail rejects the whole document.
macrosobjectNoOptional document-scoped TeX macro map. At most 64 control-word names; definitions are bounded and reset after the document. When omitted, no caller macros are defined.
numberEquationsbooleanNoOptional. Number display expressions in document order and resolve \label/\eqref within this document. Defaults to false.
includeAssistiveMathmlbooleanNoOptional. Include sanitized assistive MathML with each SVG. Defaults to true.
maxMathExpressionsintegerNoOptional. How many expressions a document may contain before we reject it; defaults to 1000 and is clamped down to 5000 if you ask for more.
timeoutMsintegerNoOptional. Milliseconds we give the typesetter before giving up; defaults to 5000 and is clamped down to 30000 if you ask for more.

Output schema

FieldTypeRequiredDescription
formatstringYesThe output format we applied, echoing your choice: html, html_svg or svg_fragments.
htmlstringNoThe rendered document for html and html_svg: by default, scoped Squillify Design System CSS plus an article carrying sqfy-markdown-v2 classes, with each expression inlined as SVG. Absent when the result went to a file or you asked for svg_fragments.
fragmentsarrayNoOnly for svg_fragments, one object per expression in document order: index (its position, matching the warning index), type ("inline" or "display"), source (the TeX we read, without its delimiters), svg (the sanitized markup, or null when that expression failed) and error, present only on failure. Empty when the document has no math.
file_refstringNoWhere we stored the rendered HTML when the result went to a file — pass it to any skill that reads a file reference.
download_urlstringNoA time-limited link to that same stored file, so you can fetch the HTML directly.
size_bytesintegerNoHow large the stored HTML is, in bytes. Present only alongside file_ref.
mathobjectYesExpression, inline, display and numbered counts plus ordered warnings.
_metaobjectYesPinned profile/parser/renderer provenance, input sizes, node count, sanitization and truncation state.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"markdown.render_math","input":{"markdown":"The formula is $x^2 + 1$."}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("markdown.render_math", {"markdown":"# Hello\n\nWorld","includeCss":false});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
MARKDOWN_INVALID_ENCODING400NoThe request payload failed this skill's input validation.
MARKDOWN_COMPLEXITY_LIMIT429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not evaluate or solve math expressions
  • Does not plot functions or generate charts
  • Does not convert Markdown into LaTeX or PDF documents
  • Does not execute arbitrary JavaScript or LaTeX
  • Evaluating or solving mathematical expressions
  • Generating PDF or standalone LaTeX documents
  • Rendering Mermaid diagrams or data charts
  • Rendering a Markdown document that happens to contain math — that is markdown.render, with components.math.mode set to auto

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "markdown.render_math",
  "input": {
    "markdown": "# Hello\n\nWorld",
    "includeCss": false
  }
}

Examples

Markdown heading and paragraph — no math expressions

Inputjson
{
  "markdown": "# Hello\n\nWorld",
  "includeCss": false
}
Expected outputjson
{
  "_meta": {
    "profile": "squillify-safe",
    "profileVersion": "1",
    "parser": "commonmark",
    "parserVersion": "0.24.0",
    "renderer": "mathjax",
    "rendererVersion": "4.1.2",
    "theme": "squillify",
    "themeVersion": "sqfy-markdown-v2",
    "cssIncluded": false,
    "inputChars": 14,
    "inputBytes": 14,
    "nodeCount": 4,
    "sanitized": true,
    "truncated": false
  },
  "format": "html_svg",
  "math": {
    "expressionCount": 0,
    "inlineCount": 0,
    "displayCount": 0,
    "numberedCount": 0,
    "warnings": []
  },
  "html": "<article class=\"sqfy-markdown sqfy-markdown-v2 sqfy-theme-squillify sqfy-markdown-math\"><h1>Hello</h1>\n<p>World</p></article>"
}

Bold text with the scientific-clean theme

Inputjson
{
  "markdown": "Plain **bold** text.",
  "theme": "scientific-clean"
}
Expected outputjson
{
  "_meta": {
    "profile": "squillify-safe",
    "profileVersion": "1",
    "parser": "commonmark",
    "parserVersion": "0.24.0",
    "renderer": "mathjax",
    "rendererVersion": "4.1.2",
    "theme": "scientific-clean",
    "themeVersion": "legacy-math-v1",
    "cssIncluded": false,
    "inputChars": 20,
    "inputBytes": 20,
    "nodeCount": 5,
    "sanitized": true,
    "truncated": false
  },
  "format": "html_svg",
  "math": {
    "expressionCount": 0,
    "inlineCount": 0,
    "displayCount": 0,
    "numberedCount": 0,
    "warnings": []
  },
  "html": "<article class=\"sqfy-markdown-math sqfy-theme-scientific-clean\"><p>Plain <strong>bold</strong> text.</p></article>"
}
  • Typeset a set of expressions into standalone SVG fragments, with no prose around them
  • Render math-heavy content to a stored file instead of an inline response
  • Typeset more expressions in a single pass than markdown.render accepts
  • Fail a pipeline outright on a malformed expression rather than degrading to source

Avoid for

  • Evaluating or solving mathematical expressions
  • Generating PDF or standalone LaTeX documents
  • Rendering Mermaid diagrams or data charts
  • Rendering a Markdown document that happens to contain math — that is markdown.render, with components.math.mode set to auto

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

formattingmarkdownmathhtml