node-fast-html-parser icon indicating copy to clipboard operation
node-fast-html-parser copied to clipboard

How to convert back to HTML

Open bahmutov opened this issue 10 years ago • 7 comments

Hi, great library, using it quickly parse HTML, is there a utility method that can convert modified tree back to HTML?

bahmutov avatar Dec 23 '15 17:12 bahmutov

I'm afraid it's not supported yet. However you could easily implement one by refering to https://github.com/ashi009/node-fast-html-parser/blob/master/index.js#L117.

ashi009 avatar Dec 24 '15 13:12 ashi009

It will be so kind if @ashi009 could provide one. I need this too.

taoqf avatar Jun 13 '17 09:06 taoqf

If anyone wants to convert back to string, see node-html-parser

taoqf avatar Jun 14 '17 09:06 taoqf

@taoqf I changed some attributes and...the outterHTML has not changed...any idea why?

felipenmoura avatar Nov 21 '17 19:11 felipenmoura

@felipenmoura You mean in node-html-parser? I did not do much about attributes except query. maybe it will be slower after converting to html if attributes changes, so i suggest you use other module, like browser-env

taoqf avatar Feb 24 '18 09:02 taoqf

Hi @taoqf I am trying to use node-html-parser so i can use outerHTML, but am getting some mysterious errors -- https://github.com/publiclab/inline-markdown-editor/pull/52 and https://travis-ci.org/publiclab/inline-markdown-editor/jobs/502286448 -- that didn't occur with fast-html-parser. Am I doing something wrong in how I'm including it there?

jywarren avatar Mar 05 '19 23:03 jywarren

Noting that it works fine in a browser, it just fails our Jasmine tests. Any help appreciated!

jywarren avatar Mar 05 '19 23:03 jywarren