直接上想要达到的效果吧;

替换前内容:

<h1>h1.1</h1><h1>h1.2</h1><div>div1<span>span1</span></div>

希望替换后内容:

<h1>Replace_h1.1</h1><h1>Replace_h1.2</h1><div>Replace_div1<span>Replace_span1</span></div>
PuerkitoBio/goqueryhtml
// 使用 goquery 替换的效果 fmt.Println(doc.Html())
<html><head></head><body><h1>Replace_h1.1</h1><h1>Replace_h1.2</h1><div>Replace_div1<span>Replace_span1</span></div></body></html>

求大佬们解惑。

有什么办法可以避免这种标签补全呢?或者有其他方案或者其他包可以实现。