Repository navigation
I am excited to announce version 0.2.0 of markdown-link-resolver!
This update brings a requested feature from the community: the ability to fetch images that are hidden behind authentication walls.
New Feature: Custom HTTP Headers
When using inline_images=True to fetch and convert images to Base64, you can now pass a headers dictionary to the function. This allows you to include Authorization tokens (like Bearer tokens), session cookies, or custom User-Agents to bypass login walls and API gateways.
Example Usage:
from markdown_link_resolver.resolver import resolve_markdown_links
# Define your custom headers
auth_headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"X-Custom-Auth": "MySecret"
}
md_with_images = "Look at this secure chart: "
# Pass them to the resolver
prepared_md = resolve_markdown_links(
md_with_images,
base_url="[https://secure.example.com/](https://secure.example.com/)",
inline_images=True,
headers=auth_headers
)Robust Fallbacks:
Just like in v0.1.0, if the server rejects the headers (e.g., 403 Forbidden) or the image times out, the tool will gracefully catch the error and fall back to the absolute URL without crashing your pipeline.
Installation/Upgrade:
pip install markdown-link-resolver==0.2.0