render

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package render converts exported content (HTML or markdown) into styled HTML documents and rendered PDFs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanHTML

func CleanHTML(v any) string

CleanHTML strips all HTML from the value and collapses surrounding whitespace

func DetailsToHTML

func DetailsToHTML(content string) string

DetailsToHTML returns the content as HTML. Content that already contains HTML markup has its text-level line breaks preserved, otherwise it is treated as markdown and converted

func ExtractDetailsStrings

func ExtractDetailsStrings(nodes []map[string]any) []string

ExtractDetailsStrings extracts string content from nodes and formats them into HTML strings for document generation. It includes common headers (name, status, timestamps) followed by the details content

func Flatten

func Flatten(prefix string, v any, out map[string]any)

Flatten flattens a nested map into a flat map with dot notation keys

func WrapDocument

func WrapDocument(body string) string

WrapDocument wraps HTML fragments in a complete, styled HTML document suitable for rendering to PDF

Types

type PDFClient

type PDFClient struct {
	// AccountID is the cloudflare account id
	AccountID string
	// APIToken is the cloudflare api token used for authentication
	APIToken string
}

PDFClient renders HTML documents into PDFs using the Cloudflare browser rendering API

func (*PDFClient) HTMLToPDF

func (c *PDFClient) HTMLToPDF(ctx context.Context, html string) ([]byte, error)

HTMLToPDF renders a complete HTML document into PDF bytes

Jump to

Keyboard shortcuts

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