@dimerapp/docs-theme
Advanced tools
Comparing version 1.0.8 to 1.1.0
import { fileURLToPath } from 'node:url'; | ||
export const docsHook = (node, pipeline) => { | ||
if (node.tagName === 'h2' || node.tagName === 'h3' || node.tagName === 'h4') { | ||
node.children = [ | ||
node.children.shift(), | ||
{ | ||
type: 'element', | ||
tagName: 'span', | ||
properties: {}, | ||
children: node.children, | ||
}, | ||
]; | ||
} | ||
if (node.tagName === 'a') { | ||
@@ -4,0 +15,0 @@ node.properties = node.properties || {}; |
@@ -20,2 +20,8 @@ /* | ||
enabled: Alpine.$persist(true).as('darkMode_enabled'), | ||
enable() { | ||
this.enabled = true | ||
}, | ||
disable() { | ||
this.enabled = false | ||
}, | ||
toggle() { | ||
@@ -53,2 +59,28 @@ this.enabled = !this.enabled | ||
/** | ||
* Popup menu | ||
*/ | ||
Alpine.store('popupMenu', { | ||
active: false, | ||
hide() { | ||
if (this.active) { | ||
this.active = false | ||
document.querySelector('body').style.overflow = 'initial' | ||
} | ||
}, | ||
show() { | ||
if (!this.active) { | ||
this.active = true | ||
document.querySelector('body').style.overflow = 'hidden' | ||
} | ||
}, | ||
toggle() { | ||
if (this.active) { | ||
this.hide() | ||
} else { | ||
this.show() | ||
} | ||
}, | ||
}) | ||
/** | ||
* Codegroups tabs manager listens for tab switch and animates | ||
@@ -146,3 +178,2 @@ * the highlighter | ||
destroy() { | ||
console.log('removing scroll listener') | ||
window.removeEventListener('scroll', this.scrollListener) | ||
@@ -149,0 +180,0 @@ }, |
15
index.ts
@@ -20,2 +20,17 @@ /* | ||
/** | ||
* Wrapping headings text inside a span | ||
*/ | ||
if (node.tagName === 'h2' || node.tagName === 'h3' || node.tagName === 'h4') { | ||
node.children = [ | ||
node.children.shift()!, | ||
{ | ||
type: 'element', | ||
tagName: 'span', | ||
properties: {}, | ||
children: node.children, | ||
}, | ||
] | ||
} | ||
/** | ||
* Opening third-party URLs inside a new tab | ||
@@ -22,0 +37,0 @@ * Opening relative in-app URLs using unpoly. |
{ | ||
"name": "@dimerapp/docs-theme", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"description": "Documentation theme built on top of Dimer and used by AdonisJS", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -43,3 +43,3 @@ # @dimerapp/docs-theme | ||
<section> | ||
<section layout-shell> | ||
@!component('docs::sidebar', { | ||
@@ -51,2 +51,4 @@ collapsible: true, | ||
<main layout-main> | ||
@!component('docs::content_header', { title: file.frontmatter.title }) | ||
@component('docs::content') | ||
@@ -56,2 +58,3 @@ @!component('docs::doc_errors', { messages: file.messages }) | ||
@end | ||
@if(file.toc) | ||
@@ -58,0 +61,0 @@ @component('docs::toc') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72771
50
1891
94