Profile readme should support any rearme file, not only README.md. Ther should be no hardcode. #11823

Closed
opened 2025-11-02 09:48:53 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @KOLANICH on GitHub (Oct 10, 2023).

Description

blob, err := commit.GetBlobByPath("README.md")

is hardcoded in c090f87a8d

It has several issues:

  1. ReadMe can be not in Markdown format
  2. ReadMe file can have another name, i.e. ReadMe.md

Instead it should use generic interfaces to deal with readmes.

Also: the mere fact this PR has been landed means there are serious problems with PR review in this project.

Gitea Version

Forgejo 1.20.4+0-65-g0fe7af40a

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Just use Codeberg

Database

None

Originally created by @KOLANICH on GitHub (Oct 10, 2023). ### Description ```go blob, err := commit.GetBlobByPath("README.md") ``` is hardcoded in https://github.com/go-gitea/gitea/commit/c090f87a8db5b51e0aa9c7278b38ddc862c048ac It has several issues: 1. ReadMe can be not in Markdown format 2. ReadMe file can have another name, i.e. `ReadMe.md` Instead it should use generic interfaces to deal with readmes. Also: the mere fact this PR has been landed means there are serious problems with PR review in this project. ### Gitea Version Forgejo 1.20.4+0-65-g0fe7af40a ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Just use Codeberg ### Database None
Author
Owner

@jolheiser commented on GitHub (Oct 10, 2023):

Well, currently it works as described. It displays only markdown, and only README.md.

You are more than welcome to propose enhancements (as you have), however it's unfair to criticize an implementation simply because it doesn't do all the things you want it to do. Iteration on features is always possible.

Your suggestions are certainly possible, and I'd be open to a PR for them.

@jolheiser commented on GitHub (Oct 10, 2023): Well, currently it works as described. It displays only markdown, and only `README.md`. You are more than welcome to propose enhancements (as you have), however it's unfair to criticize an implementation simply because it doesn't do all the things you want it to do. Iteration on features is always possible. Your suggestions are certainly possible, and I'd be open to a PR for them.
Author
Owner

@eeyrjmr commented on GitHub (Oct 10, 2023):

What if a README.md, ReadMe.md, readme.md and a ReAdMe.md file exist at the same level, what should be rendered?

This way it is clear which file will be rendered on the repository view

@eeyrjmr commented on GitHub (Oct 10, 2023): What if a README.md, ReadMe.md, readme.md and a ReAdMe.md file exist at the same level, what should be rendered? This way it is clear which file will be rendered on the repository view
Author
Owner

@wxiaoguang commented on GitHub (Oct 10, 2023):

Also: the mere fact this PR has been landed means there are serious problems with PR review in this project.

https://github.com/go-gitea/gitea/blob/main/CODE_OF_CONDUCT.md

  • Be friendly and welcoming.
  • Be respectful.
  • Be constructive.

And I see you are using Forgejo, I guess you should criticize the Forgejo team that they do not understand the code / they can't implement it / they included a commit in their codebase you don't like.

Gitea community always welcome friendly users and would try to help them to resolve problems.

@wxiaoguang commented on GitHub (Oct 10, 2023): > Also: the mere fact this PR has been landed means there are serious problems with PR review in this project. https://github.com/go-gitea/gitea/blob/main/CODE_OF_CONDUCT.md * Be friendly and welcoming. * Be respectful. * Be constructive. And I see you are using Forgejo, I guess you should criticize the Forgejo team that they do not understand the code / they can't implement it / they included a commit in their codebase you don't like. Gitea community always welcome friendly users and would try to help them to resolve problems.
Author
Owner

@delvh commented on GitHub (Oct 10, 2023):

I hope everyone has calmed down by now.
Both sides are a bit too aggressive in their wording here for my taste.

@delvh commented on GitHub (Oct 10, 2023): I hope everyone has calmed down by now. Both sides are a bit too aggressive in their wording here for my taste.
Author
Owner

@KOLANICH commented on GitHub (Oct 10, 2023):

What if a README.md, ReadMe.md, readme.md and a ReAdMe.md file exist at the same level, what should be rendered?

IMHO rendering of readmes for profiles and orgs should use the impl that is used when rendering readmes within repos. Those issues arise for repos too, but for them they are solved in some way. There is no ideal or perfect way to solve the issue of resolving ambiguity when multiple readme files are present (there are multiple possible ways: to create a list of filename stems and types and assign priorities to them like formatPriority << 8 | stemPriority, or to measure information content within files and choose the most informative of them, or evaluate quality of the text with a neural network, or combine all the files, or show none of them and instead show an error message, or choose (pseudo)randomly; each way has own pros and cons), but some way still has to be used. And it is used: for repos readmes are rendered fine (not as good as on GitHub and GitLab, there are some issues (and I may create more issues about them), but still pretty fine). I insist that a readme for a profile or an org is just a readme for a .profile repo, which is just additionally rendered on profile or org page. So the algos for repos should be used to choose the files to be rendered. I can even expect that rendering can be done once (on push, on first view or a hybrid strategy: on push do a scheduling to do rendering on idle after some time, then it can also be done on first visit), and then cached.

@KOLANICH commented on GitHub (Oct 10, 2023): >What if a README.md, ReadMe.md, readme.md and a ReAdMe.md file exist at the same level, what should be rendered? IMHO rendering of readmes for profiles and orgs should use the impl that is used when rendering readmes within repos. Those issues arise for repos too, but for them they are solved in some way. There is no ideal or perfect way to solve the issue of resolving ambiguity when multiple readme files are present (there are multiple possible ways: to create a list of filename stems and types and assign priorities to them like `formatPriority << 8 | stemPriority`, or to measure information content within files and choose the most informative of them, or evaluate quality of the text with a neural network, or combine all the files, or show none of them and instead show an error message, or choose (pseudo)randomly; each way has own pros and cons), but some way still has to be used. And it is used: for repos readmes are rendered fine (not as good as on GitHub and GitLab, there are some issues (and I may create more issues about them), but still pretty fine). I insist that a readme for a profile or an org is just a readme for a `.profile` repo, which is just additionally rendered on profile or org page. So the algos for repos should be used to choose the files to be rendered. I can even expect that rendering can be done once (on push, on first view or a hybrid strategy: on push do a scheduling to do rendering on idle after some time, then it can also be done on first visit), and then cached.
Author
Owner

@kzarist commented on GitHub (Nov 20, 2023):

I wanted to be able to use my usual README.org on my .profile "incorrect" spelling of README.md is not the only reason

@kzarist commented on GitHub (Nov 20, 2023): I wanted to be able to use my usual `README.org` on my .profile "incorrect" spelling of README.md is not the only reason
Author
Owner

@lunny commented on GitHub (Nov 20, 2023):

Please open new issue to do a proposal.

@lunny commented on GitHub (Nov 20, 2023): Please open new issue to do a proposal.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11823