package util

Import Path
	github.com/yuin/goldmark/util (on go.dev)

Dependency Relation
	imports 10 packages, and imported by 10 packages

Involved Source Files html5entities.go unicode_case_folding.go Package util provides utility functions for the goldmark. util_unsafe.go
Package-Level Type Names (total 7, in which 6 are exported)
/* sort exporteds by: | */
A BufWriter is a subset of the bufio.Writer . ( T) Available() int ( T) Buffered() int ( T) Flush() error ( T) Write(p []byte) (n int, err error) ( T) WriteByte(c byte) error ( T) WriteRune(r rune) (size int, err error) ( T) WriteString(s string) (int, error) *bufio.Writer net/http/internal.FlushAfterChunkWriter T : github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Progress T : github.com/jbenet/go-context/io.Writer T : io.ByteWriter T : io.StringWriter T : io.Writer func github.com/yuin/goldmark/renderer/html.RenderAttributes(w BufWriter, node ast.Node, filter BytesFilter) func github.com/yuin/goldmark/renderer/html.Writer.RawWrite(writer BufWriter, source []byte) func github.com/yuin/goldmark/renderer/html.Writer.Write(writer BufWriter, source []byte)
BytesFilter is a efficient data structure for checking whether bytes exist or not. BytesFilter is thread-safe. Add adds given bytes to this set. Contains return true if this set contains given bytes, otherwise false. Extend copies this filter and adds given bytes to new filter. func NewBytesFilter(elements ...[]byte) BytesFilter func BytesFilter.Extend(...[]byte) BytesFilter func github.com/yuin/goldmark/renderer/html.RenderAttributes(w BufWriter, node ast.Node, filter BytesFilter) var github.com/yuin/goldmark/extension.DefinitionDescriptionAttributeFilter var github.com/yuin/goldmark/extension.DefinitionListAttributeFilter var github.com/yuin/goldmark/extension.DefinitionTermAttributeFilter var github.com/yuin/goldmark/extension.StrikethroughAttributeFilter var github.com/yuin/goldmark/extension.TableAttributeFilter var github.com/yuin/goldmark/extension.TableHeaderAttributeFilter var github.com/yuin/goldmark/extension.TableRowAttributeFilter var github.com/yuin/goldmark/extension.TableTdCellAttributeFilter var github.com/yuin/goldmark/extension.TableThCellAttributeFilter var github.com/yuin/goldmark/renderer/html.BlockquoteAttributeFilter var github.com/yuin/goldmark/renderer/html.CodeAttributeFilter var github.com/yuin/goldmark/renderer/html.EmphasisAttributeFilter var github.com/yuin/goldmark/renderer/html.GlobalAttributeFilter var github.com/yuin/goldmark/renderer/html.HeadingAttributeFilter var github.com/yuin/goldmark/renderer/html.ImageAttributeFilter var github.com/yuin/goldmark/renderer/html.LinkAttributeFilter var github.com/yuin/goldmark/renderer/html.ListAttributeFilter var github.com/yuin/goldmark/renderer/html.ListItemAttributeFilter var github.com/yuin/goldmark/renderer/html.ParagraphAttributeFilter var github.com/yuin/goldmark/renderer/html.ThematicAttributeFilter
A CopyOnWriteBuffer is a byte buffer that copies buffer when it need to be changed. Append appends given bytes to the buffer. Append copy buffer at the first time. AppendByte appends given bytes to the buffer. AppendByte copy buffer at the first time. AppendString appends given string to the buffer. AppendString copy buffer at the first time. Bytes returns bytes of this buffer. IsCopied returns true if buffer has been copied, otherwise false. Write writes given bytes to the buffer. Write allocate new buffer and clears it at the first time. WriteByte writes the given byte to the buffer. WriteByte allocate new buffer and clears it at the first time. WriteString writes given string to the buffer. WriteString allocate new buffer and clears it at the first time. func NewCopyOnWriteBuffer(buffer []byte) CopyOnWriteBuffer
An HTML5Entity struct represents HTML5 entitites. Characters []byte CodePoints []int Name string func LookUpHTML5EntityByName(name string) (*HTML5Entity, bool)
PrioritizedSlice is a slice of the PrioritizedValues Remove removes the given value from this slice. Sort sorts the PrioritizedSlice in ascending order. func PrioritizedSlice.Remove(v interface{}) PrioritizedSlice
A PrioritizedValue struct holds pair of an arbitrary value and a priority. Priority is a priority of the value. Value is an arbitrary value that you want to prioritize. func Prioritized(v interface{}, priority int) PrioritizedValue func github.com/yuin/goldmark/parser.DefaultBlockParsers() []PrioritizedValue func github.com/yuin/goldmark/parser.DefaultInlineParsers() []PrioritizedValue func github.com/yuin/goldmark/parser.DefaultParagraphTransformers() []PrioritizedValue func github.com/yuin/goldmark/parser.WithASTTransformers(ps ...PrioritizedValue) parser.Option func github.com/yuin/goldmark/parser.WithBlockParsers(bs ...PrioritizedValue) parser.Option func github.com/yuin/goldmark/parser.WithInlineParsers(bs ...PrioritizedValue) parser.Option func github.com/yuin/goldmark/parser.WithParagraphTransformers(ps ...PrioritizedValue) parser.Option func github.com/yuin/goldmark/renderer.WithNodeRenderers(ps ...PrioritizedValue) renderer.Option
Package-Level Functions (total 48, in which 47 are exported)
BytesToReadOnlyString returns a string converted from given bytes.
DedentPosition dedents lines by the given width.
DedentPositionPadding dedents lines by the given width. This function is mostly same as DedentPosition except this function takes account into additional paddings.
DoFullUnicodeCaseFolding performs full unicode case folding to given bytes.
EscapeHTML escapes characters that should be escaped in HTML text.
EscapeHTMLByte returns HTML escaped bytes if the given byte should be escaped, otherwise nil.
FindClosure returns a position that closes the given opener. If codeSpan is set true, it ignores characters in code spans. If allowNesting is set true, closures correspond to nested opener will be ignored.
FindEmailIndex returns a stop index value if the given bytes seem an email address.
FindURLIndex returns a stop index value if the given bytes seem an URL. This function is equivalent to [A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]* .
FirstNonSpacePosition returns a position line that is a first nonspace character.
IndentPosition searches an indent position with the given width for the given line. If the line contains tab characters, paddings may be not zero. currentPos==0 and width==2: position: 0 1 [TAB]aaaa width: 1234 5678 width=2 is in the tab character. In this case, IndentPosition returns (pos=1, padding=2)
IndentPositionPadding searches an indent position with the given width for the given line. This function is mostly same as IndentPosition except this function takes account into additional paddings.
IndentWidth calculate an indent width for the given line.
IsAlphaNumeric returns true if the given character is a alphabet or a numeric, otherwise false.
IsBlank returns true if the given string is all space characters.
IsEscapedPunctuation returns true if character at a given index i is an escaped punctuation, otherwise false.
IsHexDecimal returns true if the given character is a hexdecimal, otherwise false.
IsNumeric returns true if the given character is a numeric, otherwise false.
IsPunct returns true if the given character is a punctuation, otherwise false.
IsPunctRune returns true if the given rune is a punctuation, otherwise false.
IsSpace returns true if the given character is a space, otherwise false.
IsSpaceRune returns true if the given rune is a space, otherwise false.
LookUpHTML5EntityByName returns (an HTML5Entity, true) if an entity named given name is found, otherwise (nil, false)
NewBytesFilter returns a new BytesFilter.
NewCopyOnWriteBuffer returns a new CopyOnWriteBuffer.
Prioritized returns a new PrioritizedValue.
ReadWhile read the given source while pred is true.
ReplaceSpaces replaces sequence of spaces with the given repl.
ResolveEntityNames resolve entity references like '&ouml;" .
ResolveNumericReferences resolve numeric references like '&#1234;" .
StringToReadOnlyBytes returns bytes converted from given string.
TabWidth calculates actual width of a tab at the given position.
ToLinkReference converts given bytes into a valid link reference string. ToLinkReference performs unicode case folding, trims leading and trailing spaces, converts into lower case and replace spaces with a single space character.
ToRune decode given bytes start at pos and returns a rune.
ToValidRune returns 0xFFFD if the given rune is invalid, otherwise v.
TrimLeft trims characters in the given s from head of the source. bytes.TrimLeft offers same functionalities, but bytes.TrimLeft allocates new buffer for the result.
TrimLeftLength returns a length of leading specified characters.
TrimLeftSpace returns a subslice of the given string by slicing off all leading space characters.
TrimLeftSpaceLength returns a length of leading space characters.
TrimRight trims characters in the given s from tail of the source.
TrimRightLength returns a length of trailing specified characters.
TrimRightSpace returns a subslice of the given string by slicing off all trailing space characters.
TrimRightSpaceLength returns a length of trailing space characters.
UnescapePunctuations unescapes blackslash escaped punctuations.
URLEscape escape the given URL. If resolveReference is set true: 1. unescape punctuations 2. resolve numeric references 3. resolve entity references URL encoded values (%xx) are kept as is.
UTF8Len returns a byte length of the utf-8 character.
VisualizeSpaces visualize invisible space characters.
Package-Level Variables (total 12, none are exported)