[go: up one dir, main page]

Skip to content

Render READMEs in .gitlab/ and docs/ directories

Problem to solve

GitHub renders readme files located in the .github/ or docs/ directory by default if none are present in the project root directory. See https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-readmes.

It'd be cool if GitLab could do the same with .gitlab/ and docs/ directories.

This can help unclutter the root dir, but it could also serve another purpose: serving users different readmes depending on the hosting provider. Say your project was on GitHub for historical reasons and you want to migrate to GitLab. With different readmes, you could direct users to the new project for issues and MRs/PRs (and vice-versa).

I can already achieve this with a workaround, since GitLab doesn't render .github/README.md and GitHub doesn't render INDEX.md. See demos of the same repository on GitLab and Github:

https://gitlab.com/nejch1/test-readme
https://github.com/nejch/test-readme

The only change for existing users that I can see with this is if people currently keep readmes in either of these directories for internal purposes (e.g. inside .gitlab only for repo/CI config, but not the end-user), but I doubt anyone doing that would not also have a top-level readme.

Intended users

Proposal

If no previewable readme is present in the root of the repo, try to render one in these directories.

I had a quick look but don't quite get it yet: on the Ruby side I guess this needs changes at least in lib/gitlab/file_detector.rb and maybe lib/gitlab/markup_helper.rb, and then there's app/models/tree.rb and a possibly bunch of JS 😁

Edited by Nejc Habjan