Skip to content

Commit

Permalink
added markdwon files to single modules (#630)
Browse files Browse the repository at this point in the history
* add markdown description to operation
  • Loading branch information
Nerzal committed Feb 25, 2020
1 parent 5cd03f0 commit c168a63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ When a short string in your documentation is insufficient, or you need images, c
| tag.description.markdown | Description of the tag this is an alternative to tag.description. The description will be read from a file named like tagname.md | // @tag.description.markdown |



## API Operation

**Example**
Expand All @@ -351,6 +350,7 @@ When a short string in your documentation is insufficient, or you need images, c
| annotation | description |
|-------------|----------------------------------------------------------------------------------------------------------------------------|
| description | A verbose explanation of the operation behavior. |
| description.markdown | A short description of the application. The description will be read from a file named like endpointname.md| // @description.file endpoint.description.markdown |
| id | A unique string used to identify the operation. Must be unique among all API operations. |
| tags | A list of tags to each API operation that separated by commas. |
| summary | A short summary of what the operation does. |
Expand All @@ -364,6 +364,8 @@ When a short string in your documentation is insufficient, or you need images, c
| router | Path definition that separated by spaces. `path`,`[httpMethod]` |
| x-name | The extension key, must be start by x- and take only json value. |



## Mime Types

`swag` accepts all MIME Types which are in the correct format, that is, match `*/*`.
Expand Down
6 changes: 6 additions & 0 deletions operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ func (operation *Operation) ParseComment(comment string, astFile *ast.File) erro
switch lowerAttribute {
case "@description":
operation.ParseDescriptionComment(lineRemainder)
case "@description.markdown":
commentInfo, err := getMarkdownForTag(lineRemainder, operation.parser.markdownFileDir)
if err != nil {
return err
}
operation.ParseDescriptionComment(string(commentInfo))
case "@summary":
operation.Summary = lineRemainder
case "@id":
Expand Down

0 comments on commit c168a63

Please sign in to comment.