Skip to content

Commit

Permalink
fix(docs): handle LinkTag elements without uri property
Browse files Browse the repository at this point in the history
  • Loading branch information
almostSouji committed Sep 18, 2024
1 parent f901a2c commit 5f33778
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/functions/docs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import process from 'node:process';
import { bold, codeBlock, hyperlink, inlineCode, strikethrough, underline } from '@discordjs/builders';
import { InteractionResponseType } from 'discord-api-types/v10';
import type { Response } from 'polka';
import { fetch } from 'undici';
import {
Expand Down Expand Up @@ -203,7 +202,7 @@ function effectiveItem(item: any, member?: string) {
function formatSummary(blocks: any[], _package: string, version: string) {
return blocks
.map((block) => {
if (block.kind === 'LinkTag') {
if (block.kind === 'LinkTag' && block.uri) {
const isFullLink = block.uri.startsWith('http');
const link = isFullLink ? block.uri : `${DJS_DOCS_BASE}/packages/${_package}/${version}/${block.uri}`;
return hyperlink(block.members ? `${block.text}${block.members}` : block.text, link);
Expand Down

0 comments on commit 5f33778

Please sign in to comment.