-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code highlight #3
Comments
Just some food for thought for cross platform support and implementing full syntax highlighting. 1.) It appears that Powershell and Command Prompt on Windows will not support using ansi escape codes for colourizing output out of the box. Will the solution cover Windows and *nix shells? 2.) The current raw output of the query does not provide enough information to do syntax highlighting on the code. Not too familiar with the SO api but there may be a parameter to get more detailed html. Based on the output I see currently, there is no classname on the pre element to indicate the language of the codeblock. Assumptions here could lead to improper highlighting, if for example on a reference page to ruby, there is a codeblock of javascript, shell code, sql, etc. 3.) Any attempt to implement full syntax highlighting to cover all languages without a dependancy or library seems overkill. Each language would have to be parsed to properly determine keywords, strings, comments, type identifiers etc... and then the proper escape sequence would have to be prepended to the given token in a possibly cross-platform way. 4.) In what way would the user control this colour output and adjust colour themes. Should it take advantage of 256 colour functionality in terminals that are capable, or should it play it safe and use the user defined colour sequences? 5.) Should colour output be default or behind a flag? Of course the highlighting could take a page from how2 and merely highlight the entire block a single colour, or implement a simple scheme where only primitives and keywords are highlighted in each supported language. |
I will try to answer point by point:
|
PROBLEM: The code is displayed like the rest of the answer, but we all know that it's the most important part, so it should be highlighted.
POSSIBLE SOLUTION: Get the code of the answer parsing the HTML and highlight it. (We can develop a library! Or port this one to Golang!)
The text was updated successfully, but these errors were encountered: