diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac5dec..91eb67d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -NOTE: As semantic versioning states all 0.y.z releases can contain breaking changes in API (flags, grpc API, any backward compatibility) +NOTE: As semantic versioning states all 0.y.z releases can contain breaking changes in API (flags, gRPC API, any backward compatibility) We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.) diff --git a/README.md b/README.md index d2df5e5..a06ab11 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/bwplotka/mdox) [![Latest Release](https://img.shields.io/github/release/bwplotka/mdox.svg?style=flat-square)](https://github.com/bwplotka/mdox/releases/latest) [![CI](https://github.com/bwplotka/mdox/workflows/go/badge.svg)](https://github.com/bwplotka/mdox/actions?query=workflow%3Ago) [![Go Report Card](https://goreportcard.com/badge/github.com/bwplotka/mdox)](https://goreportcard.com/report/github.com/bwplotka/mdox) [![Slack](https://img.shields.io/badge/join%20slack-%23mdox-brightgreen.svg)](https://cloud-native.slack.com/archives/mdox) -`mdox` (spelled as `md docs`) is a CLI for maintaining automated, high-quality project documentation and website leveraging [Github Flavored Markdown](https://github.github.com/gfm/) and git. +`mdox` (spelled as `md docs`) is a CLI for maintaining automated, high-quality project documentation and website leveraging [GitHub Flavored Markdown](https://github.github.com/gfm/) and git. This project can be used both as CLI as well as a library. @@ -34,7 +34,7 @@ For example, this README is formatted by the CI on every PR using [`mdox fmt -l ```bash mdox-exec="mdox fmt --help" usage: mdox fmt [] ... -Formats in-place given markdown files uniformly following GFM (Github Flavored +Formats in-place given markdown files uniformly following GFM (GitHub Flavored Markdown: https://github.github.com/gfm/). Example: mdox fmt *.md @@ -177,7 +177,7 @@ So passing in regex such as `--links.localize.address-regex="https:\/\/example\. ### Transformation -mdox allows various types of markdown file transformation which are useful for website pre-processing and is often required when using static site generators like Hugo. It helps in generating front/backmatter, renaming and moving files, and converts links to work on websites. +mdox allows various types of markdown file transformation which are useful for website pre-processing and is often required when using static site generators like Hugo. It helps in generating front/backmatter, renaming, and moving files, and converts links to work on websites. Just run `mdox transform --config-file=.mdox.yaml` and pass in YAML configuration. @@ -280,7 +280,7 @@ YAML can be passed in directly as well using `--config` flag! For more details [ Requirements to build this tool: * Go 1.19+ -* Linux or MacOS +* Linux or macOS ```shell go install github.com/bwplotka/mdox@latest diff --git a/main.go b/main.go index 43237ee..f94ac0c 100644 --- a/main.go +++ b/main.go @@ -198,7 +198,7 @@ func interrupt(logger log.Logger, cancel <-chan struct{}) error { } func registerFmt(_ context.Context, app *extkingpin.App, metricsPath *string) { - cmd := app.Command("fmt", "Formats in-place given markdown files uniformly following GFM (Github Flavored Markdown: https://github.github.com/gfm/). Example: mdox fmt *.md") + cmd := app.Command("fmt", "Formats in-place given markdown files uniformly following GFM (GitHub Flavored Markdown: https://github.github.com/gfm/). Example: mdox fmt *.md") files := cmd.Arg("files", "Markdown file(s) to process.").Required().ExistingFiles() checkOnly := cmd.Flag("check", "If true, fmt will not modify the given files, instead it will fail if files needs formatting").Bool() softWraps := cmd.Flag("soft-wraps", "If true, fmt will preserve soft line breaks for given files").Bool() diff --git a/pkg/mdformatter/linktransformer/link.go b/pkg/mdformatter/linktransformer/link.go index 7460855..a2b842d 100644 --- a/pkg/mdformatter/linktransformer/link.go +++ b/pkg/mdformatter/linktransformer/link.go @@ -258,8 +258,8 @@ func NewValidator(ctx context.Context, logger log.Logger, linksValidateConfig [] } // Set very soft limits. - // E.g github has 50-5000 https://docs.github.com/en/free-pro-team@latest/rest/reference/rate-limit limit depending - // on api (only search is below 100). + // E.g GitHub has 50-5000 https://docs.github.com/en/free-pro-team@latest/rest/reference/rate-limit limit depending + // on API (only search is below 100). if config.Timeout != "" { v.c.SetRequestTimeout(config.timeout) } @@ -551,7 +551,7 @@ func (l localLinksCache) addRelLinks(localLink string) error { func toHeaderID(header []byte) string { var id []byte // Remove punctuation from header except '-' or '#'. - // '\p{L}\p{N}\p{M}' is the unicode equivalent of '\w', https://www.regular-expressions.info/unicode.html. + // '\p{L}\p{N}\p{M}' is the Unicode equivalent of '\w', https://www.regular-expressions.info/unicode.html. punctuation := regexp.MustCompile(`[^\p{L}\p{N}\p{M}-# ]`) header = punctuation.ReplaceAll(header, []byte("")) headerText := bytes.TrimLeft(bytes.ToLower(header), "#") diff --git a/pkg/mdformatter/linktransformer/validator.go b/pkg/mdformatter/linktransformer/validator.go index 7a8a617..9787575 100644 --- a/pkg/mdformatter/linktransformer/validator.go +++ b/pkg/mdformatter/linktransformer/validator.go @@ -13,7 +13,7 @@ type Validator interface { IsValid(k futureKey, r *validator) (bool, error) } -// GitHubPullsIssuesValidator.IsValid skips visiting all github issue/PR links. +// GitHubPullsIssuesValidator.IsValid skips visiting all GitHub issue/PR links. func (v GitHubPullsIssuesValidator) IsValid(k futureKey, r *validator) (bool, error) { r.l.githubSkippedLinks.Inc() // Find rightmost index of match i.e, where regex match ends. @@ -31,7 +31,7 @@ func (v GitHubPullsIssuesValidator) IsValid(k futureKey, r *validator) (bool, er return false, nil } -// RoundTripValidator.IsValid returns true if url is checked by colly or it is a valid local link. +// RoundTripValidator.IsValid returns true if URL is checked by colly or it is a valid local link. func (v RoundTripValidator) IsValid(k futureKey, r *validator) (bool, error) { matches := remoteLinkPrefixRe.FindAllStringIndex(k.dest, 1) if matches == nil && r.validateConfig.ExplicitLocalValidators { diff --git a/pkg/mdformatter/mdgen/mdgen.go b/pkg/mdformatter/mdgen/mdgen.go index 38676d5..8baa3d0 100644 --- a/pkg/mdformatter/mdgen/mdgen.go +++ b/pkg/mdformatter/mdgen/mdgen.go @@ -34,12 +34,12 @@ func (t *genCodeBlockTransformer) TransformCodeBlock(ctx mdformatter.SourceConte return code, nil } - infoFiels, err := shellwords.NewParser().Parse(string(infoString)) + infoFields, err := shellwords.NewParser().Parse(string(infoString)) if err != nil { return nil, fmt.Errorf("parsing info string %v: %w", string(infoString), err) } infoStringAttr := map[string]string{} - for i, field := range infoFiels { + for i, field := range infoFields { val := []string{field} if i := strings.Index(field, "="); i != -1 { val = []string{field[:i], field[i+1:]} diff --git a/scripts/build-check-comments.sh b/scripts/build-check-comments.sh index d022604..792b5d2 100755 --- a/scripts/build-check-comments.sh +++ b/scripts/build-check-comments.sh @@ -12,7 +12,7 @@ set -eu # # Checks Go code comments if they have trailing period (excludes protobuffers and vendor files). # Comments with more than 3 spaces at beginning are omitted from the check, example: '// - foo'. -# This does not include top-level commments for funcs and types. +# This does not include top-level comments for funcs and types. # # Example: # func main() {