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) {
}
}
+{
+ // Patches for Djot HTML renderer.
+ const { HTMLRenderer: { prototype: htmlRendererPrototype } } = djot;
+ const { inTags: upstreamInTags } = htmlRendererPrototype;
+ htmlRendererPrototype.inTags = function (
+ tag,
+ node,
+ newlines,
+ extraAttrs = undefined,
+ ) {
+ const attributes = node.attributes ?? NIL;
+ if ("as" in attributes) {
+ const newTag = attributes.as;
+ delete attributes.as;
+ return upstreamInTags.call(
+ this,
+ newTag,
+ node,
+ newlines,
+ extraAttrs,
+ );
+ } else {
+ return upstreamInTags.call(
+ this,
+ tag,
+ node,
+ newlines,
+ extraAttrs,
+ );
+ }
+ };
+}
{
const config = await getRemoteContent("config.yaml").then((yaml) =>
parseYaml(yaml, { schema: JSON_SCHEMA })