Skip to content

Commit 8dcf6be

Browse files
committed
docs: update comments
1 parent 5a7f464 commit 8dcf6be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/declaration-signature-to-html.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,20 @@ export const declarationSignatureToHtml = async (
9797
transformers: [
9898
{
9999
span(node) {
100-
// Don't link from parameter names (e.g., don't link from `foo` in `foo: SomeType`).
100+
// Don't link from parameter names (e.g., don't link from `foo` in `(foo: Foo) => Bar`).
101+
// Valid only for `github-light` and `github-dark` themes.
101102
const style = String(node.properties["style"]).toLowerCase();
102103
if (style === "color:#e36209;--shiki-dark:#ffab70") return;
103104

105+
// Skip empty spans; see https://github.com/syntax-tree/hast#element.
104106
const firstChild = node.children[0];
105107
if (firstChild?.type !== "text") return;
106108

109+
// Don't link to this same declaration and don't link from reserved keywords.
107110
const text = firstChild.value;
108111
if (text === declaration.name || reservedKeywords.has(text)) return;
109112

113+
// Find a declaration to link to.
110114
const url = declarationUrl(text);
111115
if (!url) return;
112116

0 commit comments

Comments
 (0)