Skip to main content
Version: 3.5.1

no-html-links

确保使用 Docusaurus <Link> 组件而不是 <a> 标签。

¥Ensure that the Docusaurus <Link> component is used instead of <a> tags.

<Link> 组件内置预取和预加载。它还可以进行构建时损坏的链接检测,并帮助 Docusaurus 更好地了解你网站的结构。

¥The <Link> component has prefetching and preloading built-in. It also does build-time broken link detection, and helps Docusaurus understand your site's structure better.

规则详情

¥Rule Details

此规则的错误代码示例:

¥Examples of incorrect code for this rule:

<a href="/page">go to page!</a>

<a href="https://twitter.com/docusaurus" target="_blank">Twitter</a>

此规则的正确代码示例:

¥Examples of correct code for this rule:

import Link from '@docusaurus/Link'

<Link to="/page">go to page!</Link>

<Link to="https://twitter.com/docusaurus">Twitter</Link>

规则配置

¥Rule Configuration

接受的字段:

¥Accepted fields:

选项类型默认描述
ignoreFullyResolvedbooleanfalse设置为 true 将不会报告任何具有绝对 URL(包括协议)的 <a> 标记。