Main

markdown-checker — a markdown link validation reporting tool.

class markdown_checker.Config(skip_domains=<factory>, skip_urls_containing=<factory>, tracking_domains=<factory>, timeout=20, retries=3, retry_on_429=True, fallback_retry_delay=30, output_mode='local')

Holds all runtime configuration for a check run.

Parameters:
skip_domains: list[str]
skip_urls_containing: list[str]
tracking_domains: list[str]
timeout: int = 20
retries: int = 3
retry_on_429: bool = True
fallback_retry_delay: int = 30
output_mode: Literal['ci', 'local'] = 'local'
class markdown_checker.MarkdownLinkBase(link, line_number, file_path, issue='', issue_level='error')

Base class for markdown links

Parameters:
  • link (str)

  • line_number (int)

  • file_path (Path)

  • issue (str)

  • issue_level (Literal['error', 'warning'])

line_number: int
file_path: Path
issue: str
issue_level: Literal['error', 'warning']
has_locale()

Check if the link has a locale

Returns:

True if the link has a locale, False otherwise

Return type:

bool

has_tracking()

Check if the link has a tracking ID

Returns:

True if the link has a tracking ID, False otherwise

Return type:

bool

class markdown_checker.MarkdownPath(link, line_number, file_path, issue='', issue_level='error')

Dataclass to store info about a path

Parameters:
  • link (str)

  • line_number (int)

  • file_path (Path)

  • issue (str)

  • issue_level (Literal['error', 'warning'])

property path_without_fragments: Path

Get the path without the fragment

Returns:

The path without the fragment

remove_fragments()

Remove the fragments from a path

Returns:

The path without the fragment

Return type:

str

get_full_path()

Get the full path of the file by resolving the path without fragments

Returns:

The full path of the file

Return type:

Path

get_full_path_relative()

Get the full path of the file by resolving the path without fragments

Returns:

The full path of the file

Return type:

str

exists()

Check if the path exists

Returns:

True if the path exists, False otherwise

Return type:

bool

class markdown_checker.MarkdownURL(link, line_number, file_path, issue='', issue_level='error')

Dataclass to store info about a url

Parameters:
  • link (str)

  • line_number (int)

  • file_path (Path)

  • issue (str)

  • issue_level (Literal['error', 'warning'])

property parsed_url: ParseResult

Parse the URL and return the result

Returns:

ParseResult: The parsed URL

host_name()

Returns the hostname of the URL without the protocol

Return type:

str

check(timeout=20, retries=3, client=None, retry_on_429=True, fallback_retry_delay=30)

Check whether the URL is reachable and return a typed outcome.

Args:

timeout (int): Timeout for the request in seconds. retries (int): Number of retries if the request fails. client (httpx2.Client | None): Optional shared client for connection pooling. retry_on_429 (bool): When True, honour Retry-After headers on 429 responses. fallback_retry_delay (int): Seconds to wait when a 429 carries no Retry-After header.

Returns:

URLCheckResult with status one of: alive, broken, rate_limited, or transient_error.

Parameters:
  • timeout (int)

  • retries (int)

  • client (Client | None)

  • retry_on_429 (bool)

  • fallback_retry_delay (int)

Return type:

URLCheckResult