Skip to content

Commit a7d9b2f

Browse files
fix: fix for parsing all nested children when entry is referenced
1 parent 1aedaee commit a7d9b2f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/helper/enumerate-entries.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ export function referenceToHTML(
7777
renderOption: RenderOption,
7878
renderEmbed?: (metadata: Metadata) => EmbeddedItem | EntryNode,
7979
): string {
80+
if (node.attrs.type === 'entry' && node.attrs['display-type'] === 'link') {
81+
const entryText = node.children ? nodeChildrenToHTML(node.children, renderOption, renderEmbed) : '';
82+
if (node.attrs.target) {
83+
return `<a${node.attrs.style ? ` style="${node.attrs.style}"` : ``}${node.attrs.class ? ` class="${node.attrs.class}"` : ``}${node.attrs.id ? ` id="${node.attrs.id}"` : ``} href="${node.attrs.href || node.attrs.url}" target="${node.attrs.target}">${entryText}</a>`
84+
}
85+
return `<a${node.attrs.style ? ` style="${node.attrs.style}"` : ``}${node.attrs.class ? ` class="${node.attrs.class}"` : ``}${node.attrs.id ? ` id="${node.attrs.id}"` : ``} href="${node.attrs.href || node.attrs.url}">${entryText}</a>`;
86+
}
8087
function sendToRenderOption(referenceNode: Node): string {
8188
return (renderOption[referenceNode.type] as RenderNode)(referenceNode, undefined);
8289
}

0 commit comments

Comments
 (0)