makelink

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func StyleList

func StyleList() string

StyleList returns string Style list

Types

type Link struct {
	URL         string `json:"url,omitempty"`
	Location    string `json:"location,omitempty"`
	Canonical   string `json:"canonical,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

Link class is information of URL

func New

func New(ctx context.Context, urlStr, userAgent string) (*Link, error)

New returns new Link instance

Example
link, err := New(context.Background(), "https://git.io/vFR5M", "")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(link.Encode(StyleMarkdown))
Output:

[GitHub - goark/ml: Make Link with Markdown Format](https://github.com/goark/ml)

func (*Link) CanonicalURL

func (lnk *Link) CanonicalURL() string

CanonicalURL returns the canonical URL.

func (*Link) Encode

func (lnk *Link) Encode(t Style) io.Reader

Encode returns string (io.Reader) with other style

func (*Link) String

func (lnk *Link) String() string

func (*Link) TitleName

func (lnk *Link) TitleName() string

TitleName returns string of title name

type Style

type Style int

Style as link style

const (
	//StyleUnknown is unknown link style
	StyleUnknown Style = iota
	//StyleMarkdown is unknown markdown style
	StyleMarkdown
	//StyleWiki is unknown wiki style
	StyleWiki
	//StyleHTML is unknown HTML anchor style
	StyleHTML
	//StyleCSV is CSV data format
	StyleCSV
	//StyleJSON is JSON format
	StyleJSON
)

func GetStyle

func GetStyle(s string) (Style, error)

GetStyle returns Style from string

func (Style) String

func (t Style) String() string

Jump to

Keyboard shortcuts

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