-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add support for rendering console output with colors #19497
Conversation
a771ffd
to
4483c5f
Compare
I am very curious why the colored logs should be submitted into a git repository .... it violates the git usage. If someone really needs to use git to manage their logs, they can use an external render IMO. |
It's not only about logs, it's also about console output from many tools. Git can be used not only for code but also for documentation, it's quite common to store tool report output when doing either software functionality, load/stress or security testing and many tools does colored output for it's reports that in git become quite unreadable, thus this PR :) |
4483c5f
to
6cb8e8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that the package doesn't support io.Reader
, but code-wise LGTM.
Do I understand correctly that it would render any file that contains a literal Also note that inside markdown |
6cb8e8b
to
d21c918
Compare
True, I have added enry check and only if enry does not detect it as anything (detects as lang other) than it's rendered as console output.
Their background color would have to be changed as color codes in console output are usually meant to be displayed on black background thus there is high chance that part of that could be unreadable because of that. |
No big issue, maybe it's something for later.
Ideally the console should also have a light background on light theme. It'd certainly possible to ensure contrast via different colors for light/dark. But I guess if you're happy with just one theme, we can go with that now. |
One theme should be ok for now as usually terminal windows still have black background even on light themed desktop environment |
How about allow users setting extensions but not have the detection because the detection maybe wrong? |
It will try to detect only after language detection is done and would be otherwise rendered as plain text so chance of false rate is low. Also you can always switch to plain text display |
f23dd7a
to
2f9b50a
Compare
2f9b50a
to
7603570
Compare
* giteaofficial/main: Prevent NPE whilst migrating if there is a team request review (go-gitea#19855) [skip ci] Updated translations via Crowdin Add support for rendering terminal output with colors (go-gitea#19497) Fix viewed images not loading in a PR (go-gitea#19919) Remove out-dated comments (go-gitea#19921) Automatically render wiki TOC (go-gitea#19873) Improve wording on delete access token modal (go-gitea#19909) [skip ci] Updated translations via Crowdin Add breaking email restrictions checker in doctor (go-gitea#19903) Ensure minimum mirror interval is reported on settings page (go-gitea#19895) Improve UX on modal for deleting an access token (go-gitea#19894) update discord invite (go-gitea#19907) Only log non ErrNotExist errors in git.GetNote (go-gitea#19884) [skip ci] Updated translations via Crowdin Update frontend guideline (go-gitea#19901) Make AppDataPath absolute against the AppWorkPath if it is not (go-gitea#19815)
Fixes #19392
Extension
.sh-session
would be automatically rendered as console outputScreenshot: