pawelmalak / snippet-box

Snippet Box is a simple self-hosted app for organizing your code snippets. It allows you to easily create, edit, browse and manage your snippets in various languages.
MIT License
976 stars 80 forks source link

Feature Request: Code Formatting #28

Closed MJWherry closed 9 months ago

MJWherry commented 3 years ago

Add code formatting based on possible languages (C#, python, etc)

pawelmalak commented 3 years ago

Do you know any node.js libraries that support code formatting for multiple languages? I was only able to find formatters for html, css, json and js.

Torqu3Wr3nch commented 2 years ago

Would like to second this request- it's basically the only thing holding me back from using snippet-box.

@pawelmalak Not a node guy, but maybe highlight.js?

From https://highlightjs.org/download/:

Node.js Highlight.js can be used on the server through the API. The package with all supported languages is installable from NPM:

npm install highlight.js

By the way, great work!

pawelmalak commented 2 years ago

Snippet-box is already using highlight.js for, well, syntax highlighting. Afaik, it doesn't have option to format your code.

JaneMillor commented 2 years ago

Is there a list of supported code syntax /code formatting ? would love to see support of yaml, a example of a online syntax for yaml would be yamlchecker dot com

Would also be great to have line numbers in the code examples :-)