github

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostFromPath

func HostFromPath(path string) string

HostFromPath extracts the host portion from a URL path. e.g., "github.com/user/repo/blob/main/file.md" → "github.com"

func PathFromPath

func PathFromPath(path string) string

PathFromPath extracts the path portion (after the host) from a URL path. e.g., "github.com/user/repo/blob/main/file.md" → "user/repo/blob/main/file.md"

func ResolveRawURL

func ResolveRawURL(path string) (string, bool)

ResolveRawURL converts a GitHub/GitLab blob URL path to a raw content URL. path is the host + path portion (e.g., "github.com/user/repo/blob/main/README.md"). Returns the raw URL and true if conversion was performed, or the original path and false.

func ResolveRepoRootURLs

func ResolveRepoRootURLs(path string) []string

ResolveRepoRootURLs returns candidate raw URLs for a repository root. For repo root URLs (github.com/user/repo), returns README.md URLs for main and master branches. Returns nil if the path is not a repo root.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL