From cbd34d58b5d2bd6ac5926469df8830f54042ae38 Mon Sep 17 00:00:00 2001 From: Jarcis-cy Date: Thu, 20 Jun 2024 16:53:06 +0800 Subject: [PATCH] Add option to set MaxBuf in html.Parse --- html/parse.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/html/parse.go b/html/parse.go index 46a89eda6..375e6a970 100644 --- a/html/parse.go +++ b/html/parse.go @@ -2366,6 +2366,13 @@ func ParseOptionEnableScripting(enable bool) ParseOption { } } +// ParseOptionSetTokenizerMaxBuf sets the maximum buffer size for the tokenizer. +func ParseOptionSetTokenizerMaxBuf(maxBuf int) ParseOption { + return func(p *parser) { + p.tokenizer.SetMaxBuf(maxBuf) + } +} + // ParseWithOptions is like Parse, with options. func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error) { p := &parser{