Skip to content

MD034 - URLs should be formatted as links

Aliases: no-bare-urls

What this rule does

Ensures URLs are properly formatted with angle brackets or as clickable links, not pasted as plain text.

Why this matters

  • Clickability: Not all Markdown renderers make plain URLs clickable
  • Consistency: Mixed URL formats look unprofessional
  • Control: Proper link formatting lets you customize the display text

Examples

βœ… Correct

For more information, see <https://example.com>.

Visit [our website](https://example.com) for details.

Email us at <[email protected]>

Chat with me at <xmpp:[email protected]>

❌ Incorrect

For more information, see https://example.com.

Email us at [email protected]

Chat with me at xmpp:[email protected]

πŸ”§ Fixed

For more information, see <https://example.com>.

Email us at <[email protected]>

Chat with me at <xmpp:[email protected]>

Configuration

[MD034]
cjk-punctuation = false  # End bare URLs at full-width punctuation (default: false)
  • cjk-punctuation: When true, a bare URL or XMPP URI ends right before full-width or CJK punctuation instead of running on through it. See Full-width punctuation. cjk_punctuation is also accepted.

Automatic fixes

Outside the mdg flavor, this rule automatically wraps plain URLs, email addresses, and XMPP URIs in angle brackets (< and >). Under mdg, it reports without fixing; see below.

When a URL crosses a Jinja statement or ends inside a template expression, MD034 reports it without an automatic fix. Wrapping only part of a template can change its output or make it invalid; format these URLs manually within the template.

This rule supports GFM (GitHub Flavored Markdown) extended autolinks, including:

Full-width punctuation

GFM runs a bare URL to the next whitespace, so in CJK prose, which has no spaces around URLs, it takes in the rest of the sentence. With cjk-punctuation = true, MD034 instead ends a bare URL or XMPP URI right before full-width or CJK punctuation: 、 。 , . : οΌ› ! ? 」 』 οΌ‰ 】 〕 〉 》 ”. A οΌ‰ that closes a ( inside the URL stays part of it.

ε‚η…§οΌš<https://example.com/docs>γ€γΎγŸγ― <https://example.com/faq>。

Kanji, kana and full-width letters do not end a URL, so text written directly after a URL with no punctuation in between stays part of it.

The option is off by default because the same punctuation can be part of an internationalized URL. With it on, rumdl fmt turns https://example.com/notes/東京、倧ι˜ͺ into <https://example.com/notes/東京>、倧ι˜ͺ, which changes where the link points. Wrap such a URL in <> yourself before you turn the option on.

Markdown with Gherkin

Under the mdg flavor, MD034 reports bare URLs and email addresses but does not offer a fix. <https://example.com> is Gherkin placeholder syntax rather than an autolink: inside a Scenario Outline it is substituted from the Examples column of that name, so the standard angle-bracket fix could change the parsed scenario.

The safe response depends on context. An explicit Markdown link may be suitable for prose, but changing a step to Markdown link syntax also changes its step text. Format the link manually when that change is intended, or disable MD034 for content where a bare URL or email address is the required spelling.

See Markdown with Gherkin Flavor for the full flavor specification.

GitHub Agentic Workflows

Under the gh-aw flavor, MD034 skips complete, recognized gh-aw control lines. For example, it leaves a URL inside {{#runtime-import https://example.com/shared.md}} unchanged because inserting angle brackets would corrupt the template syntax. URLs in workflow body prose are still reported and fixed normally. See the GitHub Agentic Workflows flavor for the exact directive set.

Learn more

  • MD039 - No spaces inside link text
  • MD042 - No empty links
  • MD051 - Link anchors should exist