writable: false,
};
+const NIL = Object.preventExtensions(Object.create(null));
+
const rawBlock = (strings, ...substitutions) => ({
tag: "raw_block",
format: "html",
);
if (internalLinks.size) {
links_section.push(
- rawBlock`<details>`,
+ rawBlock`<details open="">`,
rawBlock`<summary>on this wiki</summary>`,
listOfInternalLinks(internalLinks),
rawBlock`</details>`,
}
if (externalLinks.size) {
links_section.push(
- rawBlock`<details>`,
+ rawBlock`<details open="">`,
rawBlock`<summary>elsewhere on the Web</summary>`,
{
tag: "bullet_list",
e.children.push(...links_section);
},
},
+ emph: {
+ enter: (_) => {},
+ exit: (e) => {
+ const attributes = e.attributes ?? NIL;
+ const { as } = attributes;
+ if (as) {
+ delete attributes.as;
+ if (
+ as == "b" || as == "cite" || as == "i" || as == "u"
+ ) {
+ return [
+ rawInline`<${as}>`,
+ ...e.children,
+ rawInline`</${as}>`,
+ ];
+ } else {
+ /* do nothing */
+ }
+ } else {
+ /* do nothing */
+ }
+ },
+ },
hard_break: {
enter: (_) => {
if (titleSoFar != null) {
refs,
} = result;
yield* listOfInternalLinks(refs, (link) => ({
- tag: index ? "strong" : "span",
+ tag: index == 0 ? "span" : "strong",
attributes: { "data-recency": `${index}` },
children: [
link,
- str` `,
- rawInline`<small>(<time dateTime="${dateTime}">`,
- str`${humanReadable}`,
- rawInline`</time>)</small>`,
+ ...(index == 0 ? [] : [
+ str` `,
+ rawInline`<small>(<time dateTime="${dateTime}">`,
+ str`${humanReadable}`,
+ rawInline`</time>)</small>`,
+ ]),
],
})).children;
} else {
},
rawBlock`<details id="navigation-about" open="">`,
rawBlock`<summary>about this listing</summary>`,
+ rawBlock`<article>`,
...e.children,
+ rawBlock`</article>`,
rawBlock`</details>`,
],
navigation: [
},
heading: {
enter: (e) => {
- const attributes = e.attributes ?? Object.create(null);
+ const attributes = e.attributes ?? NIL;
if (
isNavigationPage && e.level == 1 &&
attributes?.class == "main"
}
if (children.length == 0) {
const section =
- pages.get(reference)?.sections?.main ??
- Object.create(null);
+ pages.get(reference)?.sections?.main ?? NIL;
const { v } = attributes;
if (v == null) {
children.push(