pub struct GitHubPermalink {
pub owner: String,
pub repo: String,
pub git_ref: String,
pub path: String,
pub line_range: Option<LineRange>,
}Expand description
A parsed GitHub permalink.
Fields§
§owner: StringRepository owner.
repo: StringRepository name.
git_ref: StringGit ref (commit SHA or branch/tag name).
path: StringFile path within the repository.
line_range: Option<LineRange>Optional line range specification.
Implementations§
Source§impl GitHubPermalink
impl GitHubPermalink
Sourcepub fn parse_all(text: &str) -> Vec<GitHubPermalink>
pub fn parse_all(text: &str) -> Vec<GitHubPermalink>
Parses all GitHub permalink URLs from the given text.
Matches URLs with commit SHAs, branch names, or tag names.
The shared link policy applies (see super::parse_links): angle-bracket
wrapped and duplicate URLs are ignored, and at most 3 links are returned.
Sourcepub async fn fetch(
&self,
http_client: &Client,
) -> Result<ExpandedContent, ExpandError>
pub async fn fetch( &self, http_client: &Client, ) -> Result<ExpandedContent, ExpandError>
Fetches the raw file content from GitHub and returns a code block.
Sourcefn needed_lines(&self, max_lines: usize) -> usize
fn needed_lines(&self, max_lines: usize) -> usize
Number of leading lines Self::build_code_block can consume.
One line beyond the display limit is required: truncate_lines tells
“exactly at the limit” apart from “truncated” by whether a further line exists.
Sourcefn build_code_block(&self, body: &str, max_lines: usize) -> ExpandedContent
fn build_code_block(&self, body: &str, max_lines: usize) -> ExpandedContent
Builds an ExpandedContent::CodeBlock from raw file content.