ml

command module
v0.6.19 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README

ci status codeql status build status GitHub license GitHub release Go reference

ml is a CLI and Go package to fetch web page metadata and render it as links in multiple output styles (markdown, wiki, html, csv, json).

Design goals

  • Keep CLI behavior simple for command-line and stdin workflows.
  • Keep output style conversion deterministic and explicit.
  • Reuse github.com/goark/webinfo for metadata extraction logic.
  • Preserve compatibility of exported symbols when possible.

Development

Requirements
  • Go 1.26.3 or later
  • Task command (local tool for this repository)
Local validation
task test
task govulncheck

Run all maintenance tasks:

task

CI Workflows

  • ci: lint (golangci-lint with gosec), tests, and govulncheck
  • CodeQL: scheduled and push/PR static analysis
  • build: release build on v* tags via GoReleaser

Usage

Install
go install github.com/goark/ml@latest
CLI examples
ml https://git.io/vFR5M
echo https://git.io/vFR5M | ml

Use another style:

ml -s html https://git.io/vFR5M

Interactive mode:

ml -i
Input 'q' or 'quit' to stop
ml> https://git.io/vFR5M
[GitHub - goark/ml: Make Link with Markdown Format](https://github.com/goark/ml)
ml>
Public API
  • makelink.New(ctx, urlStr, userAgent) fetches metadata and builds a Link.
  • (*makelink.Link).Encode(style) renders output in the given style.
  • makelink.GetStyle(name) resolves style strings.
Use as a Go package
package main

import (
	"context"
	"fmt"
	"io"
	"os"

	"github.com/goark/ml/makelink"
)

func main() {
	lnk, err := makelink.New(context.Background(), "https://git.io/vFR5M", "")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	_, _ = io.Copy(os.Stdout, lnk.Encode(makelink.StyleMarkdown))
}

Behavior notes

  • Metadata extraction is delegated to github.com/goark/webinfo.
  • CanonicalURL() falls back in this order: canonical -> location -> input URL.
  • TitleName() falls back to URL when title is empty.

Error handling

This project wraps internal errors with github.com/goark/errs.

Modules Requirement Graph

dependency.png

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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