Synonyms
linkcode
linkplain
Syntax
{@link namepathOrURL} [link text]{@link namepathOrURL}
Overview
The {@link}
inline tag creates a link to the namepath or URL that you specify. When you use the
{@link}
tag, you can also provide link text, using one of several different formats. If you don't
provide any link text, JSDoc uses the namepath or URL as the link text.
If you need to link to a tutorial, use the {@tutorial}
inline tag instead
of the {@link}
tag.
Link formatting
By default, {@link}
generates standard HTML anchor tags. However, you may prefer to render certain
links in a monospace font, or to specify the format of individual links. You can use the following
synonyms for the {@link}
tag to control the formatting of links:
{@linkcode}
: Forces the link's text to use a monospace font.{@linkplain}
: Forces the link's text to appear as normal text, without a monospace font.
You can also set one of the following options in JSDoc's configuration file; see Configuring JSDoc for more details:
templates.cleverLinks
: When set totrue
, links to URLs use normal text, and links to code use a monospace font.templates.monospaceLinks
: When set totrue
, all links use a monospace font, except for links created with the{@linkplain}
tag.
Note: Although the default JSDoc template renders all of these tags correctly, other templates
may not recognize the {@linkcode}
and {@linkplain}
tags. In addition, other templates may ignore
the configuration options for link rendering.
Examples
The following example shows all of the ways to provide link text for the {@link}
tag:
By default, the example above produces output similar to the following:
If the configuration property templates.cleverLinks
were set to true
, the example above would
produce the following output: