If we try too parse let say a medium post is not showing the gist code, I believe that this is because the iframes are not loaded instantly and you need to navigate thought the site to the browser to render them. One solution for this could be detecting every iframe on the site and scroll to each of them so they load.
also checking the parser itself for the gist code for example in the case of the url above the iframe of some of the gist will be https://edoconti.medium.com/media/f10f007fac2ec7a4c0662ac12428a7fe
Resources on this page are lazy-loaded. Also, the gist iframes use table for layout, so it cannot be transformed into a code block or to a typical markdown table.
We have introduced a script injection mechanism to our API.
Also inside the page, we provide these utility functions/event:
- waitForSelector(selector: string): Promise<HTMLElement>
waits for the selector to appear in the DOM
- simulateScroll(): void
simulates scrolling to the bottom of the page to trigger lazyload elements
- "mutationIdle" event on document
fires when the DOM mutation is idle in 200ms
For the gist formatting, we introduced a x-with-iframe: quoted parameter to inject iframe contents as blockquote sections.
If we try too parse let say a medium post is not showing the gist code, I believe that this is because the iframes are not loaded instantly and you need to navigate thought the site to the browser to render them. One solution for this could be detecting every iframe on the site and scroll to each of them so they load.
also checking the parser itself for the gist code for example in the case of the url above the iframe of some of the gist will be
https://edoconti.medium.com/media/f10f007fac2ec7a4c0662ac12428a7fe
it parses incorrectly and return the
Resources on this page are lazy-loaded. Also, the gist iframes use table for layout, so it cannot be transformed into a
code
block or to a typical markdown table.We have introduced a script injection mechanism to our API. Also inside the page, we provide these utility functions/event:
For the gist formatting, we introduced a
x-with-iframe: quoted
parameter to inject iframe contents as blockquote sections.So eventually use this script for your URL:
The new parameters are yet to be documented but are already usable.