Anchors in documentation links are not working. In example, https://platform.openai.com/docs/api-reference/chat/streaming#usage is not scrolling to the usage
property in the corresponding section. This happens with any anchor link pointing to a property.
Thanks for reporting @pj.martorell
I just tested it and it seems to be working on my end.
It would be helpful if you could share your system specs.
I attach a demo GIF. As you see the browser should scroll to the specific property, but it’s scrolling to the section title only.
Tested on MacBook Pro M2 Pro with macOS Sonoma 14.4.1 (23E224) in Chrome 31.0.6778.109 (arm64)
The section header is missing an “A HREF” container around the icon, and the click event is on the H2 title, not the SVG link. Producing no action.
In https://platform.openai.com/static/index-d6ZApIoO.js, it must run:
function t_() {}
The individual parameters have dodgy CSS also, but that can be fixed up, so at least those don’t avoid you clicking on them and are always visible.
Temporary solutions
Bookmark script
A bookmarklet can be made, so you can click a link in the bookmark menu to fix the page:
-
Create a New Bookmark:
- Within your Bookmark Manager, choose Add New Bookmark (or New Bookmark).
- Give it a descriptive name, for example: “Fix OpenAI Param Links”.
-
Edit the Bookmark’s URL:
Instead of a normal URL (likehttps://...
), paste the following JavaScript snippet into the URL field:javascript:(function(){ var style=document.createElement('style'); style.textContent='.api-ref-anchor-link{position:unset!important;opacity:unset!important;transition:unset!important;}'; document.head.appendChild(style); })();
Ensure that the line begins with
javascript:
and that it’s all on one single line.
Note: Thejavascript:
prefix is critical. It transforms the bookmark into a bookmarklet.
TamperMonkey/Greasemonkey
A TamperMonkey script to place some CSS:
// ==UserScript==
// @name OpenAI API Docs CSS Fix
// @namespace https://platform.openai.com/
// @version 1.0
// @description Override specific CSS styles in OpenAI API documentation pages.
// @author Me
// @match https://platform.openai.com/docs/api-reference*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function () {
'use strict';
// CSS to override styles for `.api-ref-anchor-link`
const overrideCSS = `
.api-ref-anchor-link {
position: unset !important;
opacity: unset !important;
transition: unset !important;
}
`;
// Create and append a <style> tag with the CSS
const style = document.createElement('style');
style.textContent = overrideCSS;
document.head.appendChild(style);
console.log("Custom CSS for OpenAI API Docs applied.");
})();
Actual solution
Test before deploying new code
Thanks for the temporary fix, but I ran the javascript you suggested in Chrome DevTools and the issue persists.
I have no instructions saying to do that…
TamperMonkey is a browser extension that can run page-modifying scripts, here just adding some style sheet, for persistent fixes.
A bookmarklet is a bookmark that runs the script, only adding CSS when you are in the API reference page view already and select (and then you see all the links appear).