Skip to content

Commit

Permalink
fix: JSDocs comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cpreston321 committed Feb 6, 2024
1 parent ac4f9d5 commit f5b1b28
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export function heading(text: string, level: number): string {
* @param url Link URL - will be # if not provided or empty
* @param title Link title - will be same as `url` if not provided or empty
* @param opts Additional options for link
* @param opts.title Link title
* @param opts.external If true, render link as HTML anchor tag
* @returns Rendered markdown string
*
* @group render_utils
Expand All @@ -46,7 +48,7 @@ export function link(
opts?: { title?: string; external?: boolean },
): string {
if (opts?.external) {
return `<a href="${url}" title="${opts.title}" target="_blank">${text}</a>`;
return `<a href="${url}" title="${opts.title || text}" target="_blank">${text}</a>`;
}
return `[${text || url}](${url || "#"}${opts?.title ? ` "${opts.title}"` : ""})`;
}
Expand All @@ -62,8 +64,9 @@ export function link(
* ```
*
* @param url Image URL
* @param title Image title
* @param text Image text
* @param opts Additional options for image
* @param opts.title Image title
* @returns Rendered markdown string
*
* @group render_utils
Expand All @@ -87,9 +90,10 @@ export function image(
* // => "```js\nconsole.log("Hello, World!");\n```"
* ```
*
* @param text Text to be formattted as code block
* @param code Text to be formattted as code block
* @param lang Language identifier
* @param opts Additional options for code block
* @param opts.ext File extension
* @returns Rendered markdown string
*
* @group render_utils
Expand Down Expand Up @@ -119,7 +123,12 @@ export function codeBlock(
* });
* ```
*
* @returns
* @param table Table object
* @param table.rows Table rows
* @param table.columns Table columns
* @returns Rendered markdown string
*
* @group render_utils
*/
export function table(table: { rows: string[][]; columns: string[] }): string {
const header = `| ${table.columns.join(" | ")} |`;
Expand Down Expand Up @@ -259,8 +268,10 @@ export function hr(length = 3): string {
* // => "1. Item 1\n2. Item 2\n3. Item 3")
* ```
*
* @param items
* @param options
* @param items List of items
* @param opts Additional options for list
* @param opts.ordered If true, render an ordered list
* @param opts.char Custom character for list
* @returns Rendered markdown string
*
* @group render_utils
Expand Down

0 comments on commit f5b1b28

Please sign in to comment.