source

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package source opens the documents docsight converts: local paths, file: and data: URIs, and, when allowed, http(s) URLs.

Index

Constants

View Source
const MaxFetch = 256 << 20

MaxFetch bounds how much a fetched document may be.

Variables

View Source
var ErrFetchDisabled = errors.New("fetching URLs is disabled; start docsight with -allow-fetch to enable it")

ErrFetchDisabled is returned for an http(s) URL when fetching is off.

Functions

This section is empty.

Types

type Document

type Document struct {
	convert.Input
	// Key identifies this version of the document, for caching its
	// conversion: a file's path, size and modification time, or a URL.
	// It is empty when the document should not be cached.
	Key string
	// contains filtered or unexported fields
}

Document is an opened document, ready to convert.

func Open

func Open(ctx context.Context, uri string, opts Options) (*Document, error)

Open opens uri: a file path (absolute, or relative to the working directory), or a file:, data:, http: or https: URI.

func (*Document) Close

func (d *Document) Close() error

Close releases the document.

type Options

type Options struct {
	// AllowFetch lets Open fetch http and https URLs. Off by default: a
	// document server should not reach the network unless its user says so.
	AllowFetch bool
	// Client fetches URLs; nil uses a client with a one-minute timeout.
	Client *http.Client
}

Options says what Open may reach.

Jump to

Keyboard shortcuts

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