Skip to content

Code Highlight Html API

POST https://api.findutils.com/api/tools/code-highlight-html/execute

Returns syntax-highlighted HTML for a code snippet: HTML-escaped text wrapped in <span style="color: ..."> elements using one of six colour themes (dracula, monokai, github, nord, one-dark, solarized). This is the pure highlighting step of the Code Screenshot Generator page; it returns markup plus the theme background and foreground colours, not an image.

Request body

application/json
  • code

    string required

    The source code to highlight.

  • language

    string optional

    Language used for keyword and comment rules. Default: "javascript". One of javascript · typescript · python · html · css · json · markdown · bash · sql · php · java · go · rust · plaintext. Default "javascript".

  • theme

    string optional

    Colour theme. Default: "dracula". One of dracula · monokai · github · nord · one-dark · solarized. Default "dracula".

Example arguments

Verified
{
  "code": "const x = greet(\"hi\", 42);",
  "language": "javascript",
  "theme": "dracula"
}