htmlutil

package
v0.0.0-...-2cc3270 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package htmlutil provides HTML utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarkdownToHTML

func MarkdownToHTML(text string) string

MarkdownToHTML converts trusted markdown text to HTML. For untrusted markdown, use MarkdownToSafeHTML instead.

func MarkdownToSafeHTML

func MarkdownToSafeHTML(text string) safehtml.HTML

MarkdownToSafeHTML converts untrusted markdown text to safe HTML. It escapes any HTML present in the original markdown document before converting the document to HTML.

func Split

func Split(html []byte) iter.Seq[*Section]

Split returns an iterator over sections in html.

Types

type Section

type Section struct {
	Title string // title of heading
	ID    string // anchor ID of heading
	Text  string // text following heading
}

A Section is an HTML document section, which is the text following an HTML heading with an anchor ID.

Jump to

Keyboard shortcuts

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