1
from pygments import highlight
2
from pygments.lexers import guess_lexer
3
from pygments.formatters import SvgFormatter
4
5
6
def main(code: str = "export function main() { console.log(\"Hello\") }"):
7
lexer = guess_lexer(code)
8
print(f"Detected lang: {lexer.name}")
9
svg_gen = highlight(code, lexer, SvgFormatter())
10
11
return {"svg": svg_gen}
12