Convert a DOM DocumentType into a string, e.g. "<!DOCTYPE html>"

Contents of doctype-to-string
Latest commit: 0.1.4 1 year ago

src 1 year ago
test 3 years ago
.gitignore 3 years ago 1 year ago
package-lock.json 1 year ago
package.json 1 year ago


Convert a DOM DocumentType (usually obtained via document.doctype) into a string, e.g.:

  • <!DOCTYPE html>
  • <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">


npm install "git+"


npm install doctype-to-string@latest

..or equivalent


import doctypeToString from 'doctype-to-string'

const string = doctypeToString(document.doctype)


CC0; do whatever you want with this code.