diff --git a/docs/src/basics/markup_demo.djot b/docs/src/basics/markup_demo.djot index de08370..1c4ae70 100644 --- a/docs/src/basics/markup_demo.djot +++ b/docs/src/basics/markup_demo.djot @@ -1,9 +1,16 @@ # Markup demo +{.tag-aside .warning} +::: +The details of this markup are likely to change, since Djockey is experimental. +::: + ## Overriding HTML tags Djot does not ([yet](https://github.com/jgm/djot/issues/240)) support arbitrary HTML tags in its input or output. Djockey works around this by postprocessing Djot's HTML output. Whenever you add a CSS class starting with `tag-`{.language-plaintext}, Djockey will replace the element's tag with the rest of the class. +{% can't use .dj-djot-demo for features that require the entire Djockey pipeline (yet) %} + Input: ```djot diff --git a/docs/src/index.djot b/docs/src/index.djot index 748f146..e696ee9 100644 --- a/docs/src/index.djot +++ b/docs/src/index.djot @@ -31,7 +31,7 @@ Djockey is a powerful but experimental static site generator for technical writi - [x] Literal symbol parsing - [x] Dark mode - [ ] Multi-tab code blocks/divs -- [ ] Sections with and without self-docs have the same appearance but only one is clickable +- [x] Sections with and without self-docs have the same appearance but only one is clickable ### Harder stuff diff --git a/src/engine/doctree.ts b/src/engine/doctree.ts index 56bcab4..cdaf015 100644 --- a/src/engine/doctree.ts +++ b/src/engine/doctree.ts @@ -6,6 +6,7 @@ export type DocTreeSection = { title: string; relativePath: string; selfDoc: DjockeyDoc | null; + selfDocHasContent: boolean; children: DocTreeSection[]; docs: DjockeyDoc[]; }; @@ -23,6 +24,7 @@ export function loadDocTree(docs: DjockeyDoc[]): DocTree { title: "", relativePath: "", selfDoc: null, + selfDocHasContent: false, children: [], docs: [], }; @@ -37,6 +39,7 @@ export function loadDocTree(docs: DjockeyDoc[]): DocTree { title: path.parse(relativePath).name, relativePath, selfDoc: null, + selfDocHasContent: false, children: [], docs: [], }; @@ -67,6 +70,8 @@ export function loadDocTree(docs: DjockeyDoc[]): DocTree { if (path.parse(doc.filename).name === "index") { docSection.selfDoc = doc; docSection.title = doc.title; + + docSection.selfDocHasContent = !!doc.docs.content.children.length; } else { docSection.docs.push(doc); } @@ -131,7 +136,7 @@ export function connectNextAndPrevious( lastDoc = doc; } - if (section.selfDoc) { + if (section.selfDoc && section.selfDocHasContent) { processDoc(section.selfDoc); } diff --git a/src/engine/populateDocTreeDoc.ts b/src/engine/populateDocTreeDoc.ts index cb757c2..bbb4a9f 100644 --- a/src/engine/populateDocTreeDoc.ts +++ b/src/engine/populateDocTreeDoc.ts @@ -48,12 +48,12 @@ function renderSection( const result = new Array(); - if (level > 1 || section.selfDoc) { + if (level > 1 || section.selfDocHasContent) { result.push({ tag: "heading", level, children: [ - section.selfDoc + section.selfDoc && section.selfDocHasContent ? getDocLink(section.selfDoc) : { tag: "str",