mdsmith
Esc
    v0.52.0 GitHub
    MDS062 link ready

    MDS062: link-validity

    Links must not use the reversed (text)[url] form, and every link or image must have a non-empty destination; a link must also have visible text.

    This rule closes the markdownlint MD011 (no-reversed-links) and MD042 (no-empty-links) gap. Both shapes are correctness defects — the link silently does not work — so the rule is enabled by default.

    • Reversed syntax (text)[url]: CommonMark renders this as literal text, so the intended link is lost. mdsmith fix rewrites it to [text](url).
    • Empty destination [text](), [text](<>), [text](#), or a whitespace-only target: the link goes nowhere. The same check applies to images (![alt]()).
    • Empty link text [](url): the link has nothing to click. An image-only link such as [![logo](logo.png)](url) is not empty — the image is its visible content.

    A reversed pattern inside a code span, a code block, or a directive-generated body is left alone. An empty image destination is reported here; empty image alt text with a valid destination is MDS032’s concern, not this rule’s.

    # Config

    Enabled by default:

    rules:
      link-validity: true

    Disable:

    rules:
      link-validity: false

    # Examples

    # Reversed link
    
    (example)[https://example.com] points the wrong way.

    # Bad – empty destination

    # Empty target
    
    The [docs link]() has no destination.
    # Empty text
    
    A link with [](https://example.com) no text is broken.
    # Valid links
    
    A [normal link](https://example.com) works as written.
    
    The autolink <https://example.com> is also fine.

    # Good – reversed shape shown as code

    # Code span
    
    The reversed form `(text)[url]` is shown as code, not as a link.

    # Diagnostics

    ConditionMessage
    reversed (text)[url]reversed link: use [text](url) instead of (text)[url]
    empty link destinationempty link destination
    empty link textempty link text
    empty image destinationempty image destination

    # Meta-Information

    • ID: MDS062
    • Name: link-validity
    • Status: ready
    • Default: enabled
    • Fixable: reversed links only
    • Implementation: source
    • Category: link
    • markdownlint:
    • rumdl:
    • gomarklint: no-empty-links