Expand description
GitHub Permalink expansion.
This module provides functionality for parsing GitHub permalink URLs and fetching raw file content to display as code blocks.
Structsยง
- GitHub
Expander - GitHub permalink expander.
- GitHub
Permalink - A parsed GitHub permalink.
- Http
Client - TypeMap key for the shared reqwest HTTP client used to fetch raw content.
- Limited
Body ๐ - Accumulates response chunks until enough lines are received or
MAX_BODY_BYTESis exceeded. - Line
Range - A line range extracted from a GitHub permalink fragment.
Enumsยง
- GitHub
Expand Error - Errors that can occur when expanding a GitHub permalink.
Constantsยง
- MAX_
BODY_ ๐BYTES - Maximum number of body bytes read from a raw response.
Staticsยง
- GITHUB_
PERMALINK_ ๐REGEX - Regex pattern for matching GitHub blob URLs.
Functionsยง
- is_
commit_ ๐sha - Returns true if the given string looks like a commit SHA (4-40 hex characters).
- read_
body_ ๐limited - Reads the response body chunk by chunk, stopping as soon as
needed_linescomplete lines have been received. - shorten_
ref ๐ - Shortens a git ref for display. Commit SHAs are truncated to 7 characters; branch/tag names are returned as-is.
- truncate_
lines ๐ - Truncates lines to the given maximum, returning the joined string and whether truncation occurred.