|
|
|
|
|
by dwwoelfel
1942 days ago
|
|
If you're looking for this, but with an API, I built https://sourcecodeshots.com to power syntax highlighting and Open Graph images of code for https://essay.dev. I initially used carbon.now.sh, but they don't have an API, and the community-provided API is pretty slow because it uses a headless browser to generate the image. Source Code Shots uses VSCode's syntax-highlighting engine, so the highlighting is about as good as you can get and I can fully support a lot of languages that CodeMirror or Highlight.js haven't gotten to. The docs, https://sourcecodeshots.com/docs, have plenty of examples of how to use it as an API. You can email me at daniel@onegraph.com if there's something you need that it doesn't support. |
|
Since I suspect the cause here is copy-pasting off of an algorithms/code gallery, my guess is that there are examples across other languages. I checked everything I feel idiomatically comfortable enough and the others all seemed fine, but there are a lot of options here so who knows.