1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# g2h - Generate Hugo style markdown pages from your git repository history
This program allows you to generate markdown files to have a static web based interface for navigating git repositores.
Something like [cgit](https://git.zx2c4.com/cgit/) for static websites, like [stagit](https://codemadness.org/stagit.html), but emitting Markdown for use in [Hugo](https://gohugo.io)[^1].
## Goals
- Generate static pages for projects fitting for the size of a personal homepage.
- Generate markdown that can easily be integrated with Hugo.
- Make full tree state and individual files for every commit viewable and also downloadable.
- Work for [me](https://c.onl).
## Non-goals
- Provide codesearch.
- Replacement for Git forges.
- Replace cgit.
- Work for large projects, as they may be found in a company (like) setting.
- Implement any work that should be taken care of by Hugo, e.g. combining multiple projects onto a single page, feeds and custom styling.
## Usage
Let's assume your git project is in `~/development/project` and the sources for your static site are in `~/web/page`.
Then you would run this command:
```bash
g2h --repo ~/development/project --out ~/web/page --title "My awesome project" --static-subdir project --content-subdir git/project
```
The markdown files for Hugo will be placed in `~/web/page/content/git/project` and static files, like tarballs for each commit and individual file hashes, into `~/web/page/static/project`.
For a full list of options, their defaults and how they're changing the behavior of the program run `g2h --help`.
## Features
- [x] Overview page.
Table of branches and table of tags.
Each with name, most recent message summary and last modified date.
- [x] Link branch and tag name to tree view.
- [x] Link commit messages to commit page.
- [ ] Set `date` frontmatter to latest commit date from repo.
- [x] Log page.
Table with branch/tag, message summary and last modified date columns.
- [x] Link commit messages to commit page.
- [ ] Tabbed log page.
- [x] Commit page.
Collection of metadata at the beginning of the page.
Consisting of commit hash, commit date, author
Followed by the commit message and then a list of changed files.
- [x] Add redacted email to author.
- [ ] Add links to parent(s).
- [ ] Add links to child(ren).
- [ ] Show diffstat on commit page.
- [x] Add button to browse tree.
- [ ] Add button to download tree tarball.
- [x] Tree view.
Show the state of the tree at the current commit.
- [x] Folders should be traversable by clicking on their name.
- [x] Clicking on a file should open that file's page.
- [x] Individual file page.
File content in a codeblock with file extension based language detection.
For binary files a note that it can't be displayed.
- [x] Don't treat pictures as binary files.
- [ ] Breadcrumbs for navigating.
- [ ] Add button to download raw file.
- [ ] Nav bar for navigating the pages mentioned above.
- [ ] Link to special readme, if a readme can be found, rendering markdown.
- [ ] Wrapper script that takes care of `venv` setup.
- [ ] Limit to certain branch(es).
- [ ] Limit commit range.
- [ ] Parallelize generating output.
[^1]: I'm using Hugo but any static site generator with a similar layout should work.
|