Skip to content

Commit

Permalink
fix: update document genarate script
Browse files Browse the repository at this point in the history
  • Loading branch information
thuongtruong109 committed Nov 23, 2024
1 parent e9e8623 commit 3c35b50
Show file tree
Hide file tree
Showing 29 changed files with 249 additions and 2,632 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/diagram.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Create diagram
name: Diagram

on:
push:
branches:
- main

jobs:
get_data:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Update diagram
uses: githubocto/repo-visualizer@main
with:
excluded_paths: ".github,.circleci,docs,LICENSE,*.md,*.toml,*.properties,.gitignore,.bashrc,Makefile,public"
output_file: "project-structure.svg"
branch: diagram
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<table>
<tbody>
<td align="center">
<div width="800" height="0"><br>
<div width="1000" height="0"><br>
<sub>Made possible by my <a href="https://github.com/sponsors/thuongtruong109">Sponsor Program 💖</a></sub><br>
<div width="800" height="0">
<div width="1000" height="0">
</td>
</tbody>
</table>
Expand Down Expand Up @@ -261,3 +261,5 @@ $ git clone https://github.com/thuongtruong109/gouse.git
- [Golang x Github Actions](https://github.com/brpaz/github-actions-demo-go)
- [Dynamic HTML](https://css-tricks.com/dynamic-page-replacing-content)
- [Profiling Go Programs](https://blog.golang.org/pprof) - [Pprof example](https://dev.to/immortalt/use-pprof-for-golang-program-memory-analysis-2cj6) - [Gws example](https://github.com/lxzan/gws)

<!-- https://stackblitz.com/edit/vite-lsiswk?file=docs%2Findex.md -->
11 changes: 6 additions & 5 deletions cmd/doc_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,15 @@ func generateMarkdownFiles(file os.DirEntry, functions []gouse.Function, path, o

result = append(result, []byte("# "+gouse.Capitalize(gouse.TrimSuffix(file.Name(), ".go"))+"\n\n")...)

for _, function := range functions {
result = append(result, functions[0].HighlightImport()...)

for i, function := range functions {
if len(function.Import) > 0 {
result = append(result, []byte("## Imports\n\n")...)
result = append(result, function.HighlightImport()...)
result = append(result, []byte("## Functions\n\n")...)
// result = append(result, []byte("### Imports\n\n")...)
// result = append(result, []byte("### Functions\n\n")...)
}

result = append(result, function.HighlightName()...)
result = append(result, function.HighlightName(gouse.IntToString(i+1))...)
result = append(result, function.HighlightBody()...)
}

Expand Down
Loading

0 comments on commit 3c35b50

Please sign in to comment.