render

package
v1.4.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedactWithPlaceholders

func RedactWithPlaceholders(text string, entities []*entity.CanonicalEntity, opts *RedactOptions) string

RedactWithPlaceholders replaces spans in text with placeholders. When UseEnriched is false, uses legacy format [TYPE]. When true, uses <PII type="TYPE" id="N" .../> with deterministic attribute order (type, id, then allowed attributes in sorted order). Entities must be sorted by start offset and non-overlapping (caller responsibility).

Types

type AllowedAttrs

type AllowedAttrs func(entityID int) []string

AllowedAttrs returns which attributes may be emitted for an entity (by id). If nil or id not present, no extra attributes are emitted.

type RedactOptions

type RedactOptions struct {
	UseEnriched bool         // if true, render XML-style with attributes when allowed
	Allowed     AllowedAttrs // which attributes to emit per entity (used when UseEnriched)
}

RedactOptions configures placeholder rendering.

Jump to

Keyboard shortcuts

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