package
2.2.7
Repository: https://github.com/l50/goutils.git
Documentation: pkg.go.dev

# README

goutils/v2/docs

The docs package is a collection of utility functions designed to simplify common docs tasks.


Table of contents


Functions

CreatePackageDocs(afero.Fs, Repo, string, ...string)

CreatePackageDocs(afero.Fs, Repo, string, ...string) error

CreatePackageDocs generates package documentation for a Go project using a specified template file. It first checks if the template file exists in the filesystem denoted by a provided afero.Fs instance. If it exists, the function walks the project directory, excluding any specified packages, and applies the template to each non-excluded package to generate its documentation.

Parameters:

fs: An afero.Fs instance representing the filesystem.

repo: A Repo instance containing the Go project's repository details.

templatePath: A string representing the path to the template file to be used for generating the package documentation.

excludedPackages: Zero or more strings representing the names of packages to be excluded from documentation generation.

Returns:

error: An error, if it encounters an issue while checking if the template file exists, walking the project directory, or generating the package documentation.


FixCodeBlocks(string, fileutils.RealFile)

FixCodeBlocks(string, fileutils.RealFile) error

FixCodeBlocks processes a provided file to ensure that all code blocks within comments are surrounded by markdown fenced code block delimiters with the specified language.

Parameters: file: An object satisfying the File interface, which is to be processed. language: A string representing the language for the code blocks.

Returns: error: An error if there's an issue reading or writing the file.


Installation

To use the goutils/v2/docs package, you first need to install it. Follow the steps below to install via go get.

go get github.com/l50/goutils/v2/docs

Usage

After installation, you can import the package in your Go project using the following import statement:

import "github.com/l50/goutils/v2/docs"

Tests

To ensure the package is working correctly, run the following command to execute the tests for goutils/v2/docs:

go test -v

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

This project is licensed under the MIT License - see the LICENSE file for details.

# Functions

CreatePackageDocs generates package documentation for a Go project using a specified template file.
FixCodeBlocks processes a provided file to ensure that all code blocks within comments are surrounded by markdown fenced code block delimiters with the specified language.

# Structs

FuncInfo holds information about an exported function within a Go package.
FunctionDoc contains the documentation for a function within a Go package.
PackageDoc holds the documentation for a Go package.
Repo represents a GitHub repository.