cloudflare / cloudflare/cloudflare-docs
Markdown Conversion of HTML `hostname` option requires URL
- Dominant language
- MDX
- Stars
- 5.2k
- Forks
- 16.7k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 337
Description
### Existing documentation URL(s)
- https://developers.cloudflare.com/workers-ai/features/markdown-conversion/conversion-options/#html
- https://developers.cloudflare.com/workers-ai/features/markdown-conversion/how-it-works/#html
### What changes are you suggesting?
The description of the Markdown Conversion Options (e.g. for the `env.AI.toMarkdown` binding) describes the HTML `hostname` option as:
> `hostname`: string to use as a host when resolving relative links inside the HTML.
The property name and this description suggests that a bare `example.com` style hostname (e.g. the result of `URL.hostname`) should be used. However, that leaves relative links in the markdown result (if there is no `` element in the HTML itself).
It appears that this option actually requires a base URL, which will typically be the full URL of the page being converted (`URL.origin` wouldn't suffice for pages in sub-directories). The How It Works page hints at this, but it should be explicit in the description of the Conversion Options, especially since the option name itself is misleading.
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.