Open franekwitt opened 8 months ago
Does prismjs support beautifying? I think it’s just a syntax highlighter
I think that using prettier would be a good solution. It’s possible to run it on the client-side: https://prettier.io/docs/en/browser
Never mind, prettier doesn’t support cpp and python
There are wasm based formaters: https://github.com/wasm-fmt/clang-format and https://github.com/wasm-fmt/ruff_fmt
Feature request: "Beautify Code" button in the submission view. This feature would be beneficial during the manual inspection of suspected plagiarism submissions.
I can implement it but right now I'm not really sure how to approach it. The two main approaches are:
b) Running the formatter in siojail every time somebody requests a formatted view probably has too big overhead. Maybe we could run it once (with reasonable time limit) and store the formatted code in the DB but that would double the disk space taken by submissions.
c) One way to mitigate this would be to lazily generate formatted copy after the first formatted view request and then store it in the DB. However that would mean one can submit a lot of codes during long period of time and then request their formatted versions at once leading to DOS.
I believe that if we decide to do the formatting server-side we will need to restrict it to admins/teachers (that would fix only c) and not a) and b) ).