
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Info on HTML / XHTML / MathML / SVG doctypes.
This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:
npm install doctype
In Deno with Skypack:
import {doctype} from 'https://cdn.skypack.dev/doctype@3?dts'
In browsers with Skypack:
<script type="module">
import {doctype} from 'https://cdn.skypack.dev/doctype@3?min'
</script>
import {doctype} from 'doctype'
console.log(doctype(5)) // => 'html'
console.log(doctype(4.01))
console.log(doctype('4.01t'))
console.log(doctype('4.01 Transitional'))
console.log(doctype('HTML 4.01 Transitional'))
// => 'HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"'
console.log(doctype('svg'))
// => 'svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"'
This package exports the following identifiers: doctype
and
doctypes
.
There is no default export.
doctype(name)
Get a doctype from a fuzzy doctype name.
name
(string
, number
)
— fuzzy doctype name which is stripped from white space, casing, fractional
part of version, 'HTML'
or 'XHTML'
prefix, and whose suffixes are
normalized (Transitional
to t
)string?
— doctype string when found.
doctypes
Object
mapping doctype names to doctype strings.
{
'HTML 5': 'html',
'HTML 4.01 Strict': 'HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"',
// …
}
This package is fully typed with TypeScript.
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.
This package is safe.
wooorm/html-tag-names
— list of HTML tag nameswooorm/html-element-attributes
— map of HTML attributeswooorm/html-void-elements
— list of void HTML tag-nameswooorm/property-information
— info on HTML, SVG, etc propertieswooorm/web-namespaces
— map of web namespacesYes please! See How to Contribute to Open Source.
FAQs
Information for HTML doctypes
We found that doctype demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.