Readme.md 930 B

12345678910111213141516171819202122232425262728
  1. # document-outerhtml
  2. Like [Element.outerHTML][], but for the whole [Document][].
  3. This means it returns a string containing the `<html>.....</html>` with all the content between, plus the `<!DOCTYPE ....>` declaration (if present), and any comments and stray elements or text nodes.
  4. # Install
  5. npm install document-outerhtml
  6. # Usage
  7. import documentOuterHTML from 'document-outerhtml'
  8. const html = documentOuterHTML(document)
  9. # Licence
  10. [CC0](https://creativecommons.org/publicdomain/zero/1.0/); do whatever you want with this code.
  11. # See also
  12. - [XMLSerializer.serializeToString][]; does nearly the same thing, except it creates XML.
  13. [Element.outerHTML]: https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML
  14. [Document]: https://developer.mozilla.org/en-US/docs/Web/API/Document
  15. [XMLSerializer.serializeToString]: https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer/serializeToString