msva / lua-htmlparser

An HTML parser for lua.
231 stars 44 forks source link

How to edit the elements? #58

Closed stevenhu888 closed 1 year ago

stevenhu888 commented 2 years ago

Hi,I'm using this lib to modify nginx response body.The docs just tell me how to parse html elements,but how can I edit the elements by some method?I dont have any idear about it,please give me some tips,thank you~

msva commented 1 year ago

This lib is called "parser" for the reason, that it is for parsing, not editing. However, you can modify the DOM-table, that parser returns. There are even some functions implemented for that.

But the purpose of the library is to parse, there is no direct converter from the DOM-table back to html-code. Although, again, it should not be that hard to imlement it manually