rendering

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 13 Imported by: 0

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_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 Shutdown added in v0.6.3

func Shutdown() error

Types

This section is empty.

Jump to

Keyboard shortcuts

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