rendering

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 13 Imported by: ? modules, 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 rendering provides a function to render HTML to images or HTML after JS execution. It uses the Chrome Debug Protocol through the rod package. It will download a headless Chrome version if needed that matches the current platform.

If the environment variable SND_CHROME_DEBUG=1 it will start the chrome instances in non-headless mode.

Index

Constants

View Source
const IdleRequestTimeout = 5
View Source
const ReadyTimeout = 5

Variables

This section is empty.

Functions

func ExtractHTML added in v0.5.0

func ExtractHTML(url string, selector string) (string, error)

ExtractHTML opens the URL, lets the page executes and returns the HTML.

func InitBrowser added in v0.7.0

func InitBrowser()

func RenderHTML

func RenderHTML(html string, width int) (image.Image, error)

RenderHTML renders the element #content into an image.

func RenderURL added in v0.4.1

func RenderURL(url string, width int) (image.Image, error)

RenderURL opens the URL and renders the element #content into an image.

func SetAndroidRenderer added in v1.3.0

func SetAndroidRenderer(renderer AndroidRenderer)

func Shutdown added in v0.6.3

func Shutdown() error

Types

type AndroidRenderer added in v1.3.0

type AndroidRenderer interface {
	RenderURL(url string, width int32) ([]byte, error)
	ExtractHTML(url string, selector string) (string, error)
}

Jump to

Keyboard shortcuts

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