summaryrefslogtreecommitdiff
path: root/src/frontend/h.ts
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-30 10:51:31 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-30 10:51:31 -0400
commit3b27eaac4384e82e7f08122f0797a9671470781a (patch)
tree8c4c1b653d7f947e1589a35046ef4f64b92d7c97 /src/frontend/h.ts
parentdbd764bdeb2b514a426690cedb390edb9c2a75de (diff)
downloadastro-3b27eaac4384e82e7f08122f0797a9671470781a.tar.gz
astro-3b27eaac4384e82e7f08122f0797a9671470781a.tar.zst
astro-3b27eaac4384e82e7f08122f0797a9671470781a.zip
Add support for doctype (#37)
* Add support for doctype * Automatically prepend doctype
Diffstat (limited to '')
-rw-r--r--src/frontend/h.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/frontend/h.ts b/src/frontend/h.ts
index cd94583f8..70965e135 100644
--- a/src/frontend/h.ts
+++ b/src/frontend/h.ts
@@ -6,6 +6,15 @@ export type HTag = string | AstroComponent;
const voidTags = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
function* _h(tag: string, attrs: HProps, children: Array<HChild>) {
+ if(tag === '!doctype') {
+ yield '<!doctype ';
+ if(attrs) {
+ yield Object.keys(attrs).join(' ');
+ }
+ yield '>';
+ return;
+ }
+
yield `<${tag}`;
if (attrs) {
yield ' ';