How do I fix wrongly nested / unclosed HTML tags?

前端 未结 5 1239
悲&欢浪女
悲&欢浪女 2020-12-01 09:56

I need to sanitize HTML submitted by the user by closing any open tags with correct nesting order. I have been looking for an algorithm or Python code to do this but haven\'

5条回答
  •  旧巷少年郎
    2020-12-01 10:22

    Run it through Tidy or one of its ported libraries.

    Try to code it by hand and you will want to gouge your eyes out.

提交回复
热议问题