« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateContentHeading.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateContentHeading.js')
-rw-r--r--src/content/dependencies/generateContentHeading.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/content/dependencies/generateContentHeading.js b/src/content/dependencies/generateContentHeading.js
new file mode 100644
index 00000000..1666ef4b
--- /dev/null
+++ b/src/content/dependencies/generateContentHeading.js
@@ -0,0 +1,27 @@
+export default {
+  extraDependencies: [
+    'html',
+  ],
+
+  generate({html}) {
+    return html.template({
+      annotation: 'generateContentHeading',
+
+      slots: {
+        title: {type: 'html'},
+        id: {type: 'string'},
+        tag: {type: 'string', default: 'p'},
+      },
+
+      content(slots) {
+        return html.tag(slots.tag,
+          {
+            class: 'content-heading',
+            id: slots.id,
+            tabindex: '0',
+          },
+          slots.title);
+      },
+    });
+  }
+}