mdxify.source_links
Utilities for generating source code links.
Functions
detect_github_repo_url
get_relative_path
file_path
: Absolute path to the source fileroot_module
: The root module name (e.g., ‘prefect’, ‘fastmcp’)
- Relative path from repo root, or None if unable to determine
generate_source_link
repo_url
: GitHub repository URL (e.g., https://github.com/owner/repo)branch
: Git branch namefile_path
: Path to the source fileline_number
: Line number in the source fileroot_module
: Root module name for finding relative paths
- GitHub URL to the specific line, or None if unable to generate
add_source_link_to_header
header
: The markdown header (e.g., ”###function_name
”)source_link
: The source code URLlink_text
: Text for the link (default: “[source]”)
- Header with inline source link icon