Skip to content
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

Fixes Issue 1829 #1830

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,13 @@ func isGeneralAPIComment(comments []string) bool {
}

func getMarkdownForTag(tagName string, dirPath string) ([]byte, error) {
if tagName == "" {
// this happens when parsing the @description.markdown attribute
// it will be called properly another time with tagName="api"
// so we can safely return an empty byte slice here
return make([]byte, 0), nil
}

dirEntries, err := os.ReadDir(dirPath)
if err != nil {
return nil, err
Expand All @@ -897,11 +904,12 @@ func getMarkdownForTag(tagName string, dirPath string) ([]byte, error) {

fileName := entry.Name()

if !strings.Contains(fileName, ".md") {
continue
expectedFileName := tagName
if !strings.HasSuffix(tagName, ".md") {
expectedFileName = tagName + ".md"
}

if strings.Contains(fileName, tagName) {
if fileName == expectedFileName {
fullPath := filepath.Join(dirPath, fileName)

commentInfo, err := os.ReadFile(fullPath)
Expand Down
Loading