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

Small fixes in project #20

Merged
merged 12 commits into from
Oct 4, 2024
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.18.x
go-version: 1.23.x
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --rm-dist
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,30 @@ jobs:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{matrix.platform}}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.18.x
go-version: 1.23.x
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Lint
uses: magefile/mage-action@v1
uses: magefile/mage-action@v3
with:
version: latest
args: lint
- name: Doc Verify
uses: magefile/mage-action@v1
uses: magefile/mage-action@v3
with:
version: latest
args: docVerify
- name: Test
uses: magefile/mage-action@v1
uses: magefile/mage-action@v3
with:
version: latest
args: test
- name: Upload Coverage
if: ${{ matrix.platform == 'ubuntu-latest' }}
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ linters:
disable:
- gosimple
- staticcheck
- structcheck
- unused

linters-settings:
Expand All @@ -27,6 +26,11 @@ linters-settings:
max-func-lines: 10
revive:
min-confidence: 0.5
rules:
- name: package-comments
disabled: true
- name: unused-parameter
disabled: true

issues:
exclude-rules:
Expand Down
90 changes: 45 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<!-- Code generated by gomarkdoc. DO NOT EDIT -->

[![Go Report Card](https://goreportcard.com/badge/github.com/princjef/gomarkdoc)](https://goreportcard.com/report/github.com/princjef/gomarkdoc)
[![GitHub Actions](https://github.com/princjef/gomarkdoc/workflows/Test/badge.svg)](https://github.com/princjef/gomarkdoc/actions?query=workflow%3ATest+branch%3Amaster)
[![Go Reference](https://pkg.go.dev/badge/github.com/princjef/gomarkdoc.svg)](https://pkg.go.dev/github.com/princjef/gomarkdoc)
[![Go Report Card](https://goreportcard.com/badge/github.com/Weborama/gomarkdoc)](https://goreportcard.com/report/github.com/Weborama/gomarkdoc)
[![GitHub Actions](https://github.com/Weborama/gomarkdoc/workflows/Test/badge.svg)](https://github.com/Weborama/gomarkdoc/actions?query=workflow%3ATest+branch%3Amaster)
[![Go Reference](https://pkg.go.dev/badge/github.com/Weborama/gomarkdoc.svg)](https://pkg.go.dev/github.com/Weborama/gomarkdoc)
[![codecov](https://codecov.io/gh/princjef/gomarkdoc/branch/master/graph/badge.svg?token=171XNH5XLT)](https://codecov.io/gh/princjef/gomarkdoc)

# gomarkdoc

```go
import "github.com/princjef/gomarkdoc"
import "github.com/Weborama/gomarkdoc"
```

Package gomarkdoc formats documentation for one or more packages as markdown for usage outside of the main https://pkg.go.dev site. It supports custom templates for tweaking representation of documentation at fine\-grained levels, exporting both exported and unexported symbols, and custom formatters for different backends.

### Command Line Usage
\# Command Line Usage

If you want to use this package as a command\-line tool, you can install the command by running the following on go 1.16\+:

```
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
go install github.com/Weborama/gomarkdoc/cmd/gomarkdoc@latest
```

For older versions of go, you can install using the following method instead:

```
GO111MODULE=on go get -u github.com/princjef/gomarkdoc/cmd/gomarkdoc
GO111MODULE=on go get -u github.com/Weborama/gomarkdoc/cmd/gomarkdoc
```

The command line tool supports configuration for all of the features of the importable package:
Expand Down Expand Up @@ -64,11 +64,11 @@ The gomarkdoc command processes each of the provided packages, generating docume
gomarkdoc --output doc.md .
```

### Package Specifiers
\# Package Specifiers

The gomarkdoc tool supports generating documentation for both local packages and remote ones. To specify a local package, start the name of the package with a period \(.\) or specify an absolute path on the filesystem. All other package signifiers are assumed to be remote packages. You may specify both local and remote packages in the same command invocation as separate arguments.

### Output Redirection
\# Output Redirection

By default, the documentation generated by the gomarkdoc command is sent to standard output, where it can be redirected to a file. This can be useful if you want to perform additional modifications to the documentation or send it somewhere other than a file. However, keep in mind that there are some inconsistencies in how various shells/platforms handle redirected command output \(for example, Powershell encodes in UTF\-16, not UTF\-8\). As a result, the \-\-output option described below is recommended for most use cases.

Expand All @@ -82,42 +82,42 @@ If you want to redirect output for each processed package to a file, you can pro
gomarkdoc --output '{{.Dir}}/README.md' ./...
```

You can see all of the data available to the output template in the PackageSpec struct in the github.com/princjef/gomarkdoc/cmd/gomarkdoc package.
You can see all of the data available to the output template in the PackageSpec struct in the github.com/Weborama/gomarkdoc/cmd/gomarkdoc package.

### Template Overrides
\# Template Overrides

The documentation information that is output is formatted using a series of text templates for the various components of the overall documentation which get generated. Higher level templates contain lower level templates, but any template may be replaced with an override template using the \-\-template/\-t option. The full list of templates that may be overridden are:

```
- file: generates documentation for a file containing one or more
packages, depending on how the tool is configured. This is the
root template for documentation generation.
packages, depending on how the tool is configured. This is the
root template for documentation generation.

- package: generates documentation for an entire package.

- type: generates documentation for a single type declaration, as well
as any related functions/methods.
as any related functions/methods.

- func: generates documentation for a single function or method. It may
be referenced from within a type, or directly in the package,
depending on nesting.
be referenced from within a type, or directly in the package,
depending on nesting.

- value: generates documentation for a single variable or constant
declaration block within a package.
declaration block within a package.

- index: generates an index of symbols within a package, similar to what
is seen for godoc.org. The index links to types, funcs,
variables, and constants generated by other templates, so it may
need to be overridden as well if any of those templates are
changed in a material way.
is seen for godoc.org. The index links to types, funcs,
variables, and constants generated by other templates, so it may
need to be overridden as well if any of those templates are
changed in a material way.

- example: generates documentation for a single example for a package or
one of its symbols. The example is generated alongside whichever
symbol it represents, based on the standard naming conventions
outlined in https://blog.golang.org/examples#TOC_4.
one of its symbols. The example is generated alongside whichever
symbol it represents, based on the standard naming conventions
outlined in https://blog.golang.org/examples#TOC_4.

- doc: generates the freeform documentation block for any of the above
structures that can contain a documentation section.
structures that can contain a documentation section.

- import: generates the import code used to pull in a package.
```
Expand All @@ -128,7 +128,7 @@ Overriding with the \-t option uses a key\-vaule pair mapping a template name to
gomarkdoc -t package=custom-package.gotxt -t doc=custom-doc.gotxt .
```

### Additional Options
\# Additional Options

As with the godoc tool itself, only exported symbols will be shown in documentation. This can be expanded to include all symbols in a package by adding the \-\-include\-unexported/\-u flag.

Expand Down Expand Up @@ -179,16 +179,16 @@ gomarkdoc -vv -o README.md .
Some features of gomarkdoc rely on being able to detect information from the git repository containing the project. Since individual local git repositories may be configured differently from person to person, you may want to manually specify the information for the repository to remove any inconsistencies. This can be achieved with the \-\-repository.url, \-\-repository.default\-branch and \-\-repository.path options. For example, this repository would be configured with:

```
gomarkdoc --repository.url "https://github.com/princjef/gomarkdoc" --repository.default-branch master --repository.path / -o README.md .
gomarkdoc --repository.url "https://github.com/Weborama/gomarkdoc" --repository.default-branch master --repository.path / -o README.md .
```

### Configuring via File
\# Configuring via File

If you want to reuse configuration options across multiple invocations, you can specify a file in the folder where you invoke gomarkdoc containing configuration information that you would otherwise provide on the command line. This file may be a JSON, TOML, YAML, HCL, env, or Java properties file, but the name is expected to start with .gomarkdoc \(e.g. .gomarkdoc.yml\).

All configuration options are available with the camel\-cased form of their long name \(e.g. \-\-include\-unexported becomes includeUnexported\). Template overrides are specified as a map, rather than a set of key\-value pairs separated by =. Options provided on the command line override those provided in the configuration file if an option is present in both.

### Programmatic Usage
\# Programmatic Usage

While most users will find the command line utility sufficient for their needs, this package may also be used programmatically by installing it directly, rather than its command subpackage. The programmatic usage provides more flexibility when selecting what packages to work with and what components to generate documentation for.

Expand All @@ -202,9 +202,9 @@ import (
"fmt"
"os"

"github.com/princjef/gomarkdoc"
"github.com/princjef/gomarkdoc/lang"
"github.com/princjef/gomarkdoc/logger"
"github.com/Weborama/gomarkdoc"
"github.com/Weborama/gomarkdoc/lang"
"github.com/Weborama/gomarkdoc/logger"
)

func main() {
Expand Down Expand Up @@ -237,9 +237,9 @@ func main() {
}
```

### Examples
\# Examples

This project uses itself to generate the README files in github.com/princjef/gomarkdoc and its subdirectories. To see the commands that are run to generate documentation for this repository, take a look at the Doc\(\) and DocVerify\(\) functions in magefile.go and the .gomarkdoc.yml file in the root of this repository. To run these commands in your own project, simply replace \`go run ./cmd/gomarkdoc\` with \`gomarkdoc\`.
This project uses itself to generate the README files in github.com/Weborama/gomarkdoc and its subdirectories. To see the commands that are run to generate documentation for this repository, take a look at the Doc\(\) and DocVerify\(\) functions in magefile.go and the .gomarkdoc.yml file in the root of this repository. To run these commands in your own project, simply replace \`go run ./cmd/gomarkdoc\` with \`gomarkdoc\`.

Know of another project that is using gomarkdoc? Open an issue with a description of the project and link to the repository and it might be featured here\!

Expand All @@ -257,7 +257,7 @@ Know of another project that is using gomarkdoc? Open an issue with a descriptio
- [func WithTemplateOverride(name, tmpl string) RendererOption](<#func-withtemplateoverride>)


## type [Renderer](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L15-L19>)
## type [Renderer](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L15-L19>)

Renderer provides capabilities for rendering various types of documentation with the configured format and templates.

Expand All @@ -267,71 +267,71 @@ type Renderer struct {
}
```

### func [NewRenderer](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L30>)
### func [NewRenderer](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L30>)

```go
func NewRenderer(opts ...RendererOption) (*Renderer, error)
```

NewRenderer initializes a Renderer configured using the provided options. If nothing special is provided, the created renderer will use the default set of templates and the GitHubFlavoredMarkdown.

### func \(\*Renderer\) [Example](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L140>)
### func \(\*Renderer\) [Example](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L140>)

```go
func (out *Renderer) Example(ex *lang.Example) (string, error)
```

Example renders an example's documentation to a string. You can change the rendering of the example by overriding the "example" template or one of the templates it references.

### func \(\*Renderer\) [File](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L112>)
### func \(\*Renderer\) [File](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L112>)

```go
func (out *Renderer) File(file *lang.File) (string, error)
```

File renders a file containing one or more packages to document to a string. You can change the rendering of the file by overriding the "file" template or one of the templates it references.

### func \(\*Renderer\) [Func](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L126>)
### func \(\*Renderer\) [Func](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L126>)

```go
func (out *Renderer) Func(fn *lang.Func) (string, error)
```

Func renders a function's documentation to a string. You can change the rendering of the package by overriding the "func" template or one of the templates it references.

### func \(\*Renderer\) [Package](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L119>)
### func \(\*Renderer\) [Package](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L119>)

```go
func (out *Renderer) Package(pkg *lang.Package) (string, error)
```

Package renders a package's documentation to a string. You can change the rendering of the package by overriding the "package" template or one of the templates it references.

### func \(\*Renderer\) [Type](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L133>)
### func \(\*Renderer\) [Type](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L133>)

```go
func (out *Renderer) Type(typ *lang.Type) (string, error)
```

Type renders a type's documentation to a string. You can change the rendering of the type by overriding the "type" template or one of the templates it references.

## type [RendererOption](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L22>)
## type [RendererOption](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L22>)

RendererOption configures the renderer's behavior.

```go
type RendererOption func(renderer *Renderer) error
```

### func [WithFormat](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L102>)
### func [WithFormat](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L102>)

```go
func WithFormat(format format.Format) RendererOption
```

WithFormat changes the renderer to use the format provided instead of the default format.

### func [WithTemplateOverride](<https://github.com/princjef/gomarkdoc/blob/master/renderer.go#L88>)
### func [WithTemplateOverride](<https://github.com/Weborama/gomarkdoc/blob/master/renderer.go#L88>)

```go
func WithTemplateOverride(name, tmpl string) RendererOption
Expand All @@ -341,4 +341,4 @@ WithTemplateOverride adds a template that overrides the template with the provid



Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
Generated by [gomarkdoc](<https://github.com/Weborama/gomarkdoc>)
8 changes: 4 additions & 4 deletions cmd/gomarkdoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
# gomarkdoc

```go
import "github.com/princjef/gomarkdoc/cmd/gomarkdoc"
import "github.com/Weborama/gomarkdoc/cmd/gomarkdoc"
```

Package gomarkdoc provides a command line interface for writing golang documentation in markdown format.

See https://github.com/princjef/gomarkdoc for full documentation of this tool.
See https://github.com/Weborama/gomarkdoc for full documentation of this tool.

## Index

- [type PackageSpec](<#type-packagespec>)


## type [PackageSpec](<https://github.com/princjef/gomarkdoc/blob/master/cmd/gomarkdoc/command.go#L30-L44>)
## type [PackageSpec](<https://github.com/Weborama/gomarkdoc/blob/master/cmd/gomarkdoc/command.go#L30-L44>)

PackageSpec defines the data available to the \-\-output option's template. Information is recomputed for each package generated.

Expand All @@ -36,4 +36,4 @@ type PackageSpec struct {



Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
Generated by [gomarkdoc](<https://github.com/Weborama/gomarkdoc>)
Loading
Loading