跳到主要内容
版本:Canary 🚧

no-html-links

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

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.

规则详情

此规则的错误代码示例:

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

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

此规则的正确代码示例:

import Link from '@docusaurus/Link'

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

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

规则配置

接受的字段:

选项类型默认值描述
ignoreFullyResolvedbooleanfalseSet to true will not report any <a> tags with absolute URLs including a protocol.