Quaqqer / nekontrol

A program that compiled, runs and tests kattis solutions
5 stars 1 forks source link

'show' subcommand #6

Open sornas opened 1 year ago

sornas commented 1 year ago

https://github.com/cshuaimin/uva does nice output formatting of UVa problems. I think we should do something similar. Unfortunately I think we would need to parse and re-format HTML. There should be libraries that does this end-to-end (i.e. all the way from HTML to Markdown-like) but since most Kattis problems are structured the same we could probably do it ourself for more control.

Open questions:

UVa CLI output Code formatting in summaries suck so here's a screenshot. ![image](https://github.com/Quaqqer/nekontrol/assets/4735435/74d93831-741c-4649-b63e-ae8f336a2f1e)
Suggested nekontrol output ![image](https://github.com/Quaqqer/nekontrol/assets/4735435/c47bdd72-e45b-4408-9508-010ef7e01902)
sornas commented 1 year ago

Images would be sixel if supported by the terminal, otherwise links.

LaTeX is a bigger problem. Copying the MathJax source (basically LaTeX) is a possibility but might look like shit. There does not seem to exist any obvious solutions for typesetting LaTeX as plain text (honestly, reasonable). Should at least try to implement and see how it looks and if it's better than switching to/from the browser.

sornas commented 1 year ago

nk open could also open the problem in the default browser.

Quaqqer commented 1 year ago

Would the idea be that show or open would automatically open the problem from the correct site by guessing? Should nk open hello check first kattis then uva? Another option may be nk open k:hello, nk open kattis:hello or something like that.

sornas commented 1 year ago

I'm thinking it checks all sources for a matching problem, and if there are more than one you get prompted.

At least for UVa and Kattis there will probably not be many collisions since UVa seems to only use numbers as identification.