From f8aab4943143a92db46c76c577ba492c2ff54cc6 Mon Sep 17 00:00:00 2001 From: Jeff Principe Date: Fri, 16 Jun 2023 08:50:06 -0700 Subject: [PATCH] fix(lang): only print url for auto links (#100) --- README.md | 4 ++-- cmd/gomarkdoc/README.md | 2 +- format/README.md | 6 +++--- lang/span.go | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e0a5bf0..0a428be 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ import "github.com/princjef/gomarkdoc" ``` -Package gomarkdoc formats documentation for one or more packages as markdown for usage outside of the main https://pkg.go.dev[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. +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 @@ -100,7 +100,7 @@ The documentation information that is output is formatted using a series of text - 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. -- 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[https://blog.golang.org/examples#TOC_4](). +- 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. - doc: generates the freeform documentation block for any of the above structures that can contain a documentation section. diff --git a/cmd/gomarkdoc/README.md b/cmd/gomarkdoc/README.md index 1f6d7dd..aa295fc 100644 --- a/cmd/gomarkdoc/README.md +++ b/cmd/gomarkdoc/README.md @@ -8,7 +8,7 @@ import "github.com/princjef/gomarkdoc/cmd/gomarkdoc" Package gomarkdoc provides a command line interface for writing golang documentation in markdown format. -See https://github.com/princjef/gomarkdoc[https://github.com/princjef/gomarkdoc]() for full documentation of this tool. +See https://github.com/princjef/gomarkdoc for full documentation of this tool. ## Index diff --git a/format/README.md b/format/README.md index fcd3d55..6b44224 100755 --- a/format/README.md +++ b/format/README.md @@ -69,7 +69,7 @@ Each of the formats in this package contains the same set of formatting function ## type [AzureDevOpsMarkdown]() -AzureDevOpsMarkdown provides a Format which is compatible with Azure DevOps's syntax and semantics. See the Azure DevOps documentation for more details about their markdown format: https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops[https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops]() +AzureDevOpsMarkdown provides a Format which is compatible with Azure DevOps's syntax and semantics. See the Azure DevOps documentation for more details about their markdown format: https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops ```go type AzureDevOpsMarkdown struct{} @@ -196,7 +196,7 @@ ListEntry generates an unordered list entry with the provided text at the provid func (f *AzureDevOpsMarkdown) LocalHref(headerText string) (string, error) ``` -LocalHref generates an href for navigating to a header with the given headerText located within the same document as the href itself. Link generation follows the guidelines here: https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops#anchor-links[https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops#anchor-links]() +LocalHref generates an href for navigating to a header with the given headerText located within the same document as the href itself. Link generation follows the guidelines here: https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops#anchor-links ### func \(\*AzureDevOpsMarkdown\) [RawAnchorHeader]() @@ -307,7 +307,7 @@ type Format interface { ## type [GitHubFlavoredMarkdown]() -GitHubFlavoredMarkdown provides a Format which is compatible with GitHub Flavored Markdown's syntax and semantics. See GitHub's documentation for more details about their markdown format: https://guides.github.com/features/mastering-markdown/[https://guides.github.com/features/mastering-markdown/]() +GitHubFlavoredMarkdown provides a Format which is compatible with GitHub Flavored Markdown's syntax and semantics. See GitHub's documentation for more details about their markdown format: https://guides.github.com/features/mastering-markdown/ ```go type GitHubFlavoredMarkdown struct{} diff --git a/lang/span.go b/lang/span.go index db39d81..f09d011 100644 --- a/lang/span.go +++ b/lang/span.go @@ -91,6 +91,7 @@ func ParseSpans(cfg *Config, texts []comment.Text) []*Span { if v.Auto { s = append(s, NewSpan(cfg.Inc(0), AutolinkSpan, str, str)) + break } s = append(s, NewSpan(cfg.Inc(0), LinkSpan, str, v.URL))