Skip to content

Instantly share code, notes, and snippets.

@Sarverott
Created March 4, 2026 09:48
Show Gist options
  • Select an option

  • Save Sarverott/287690903481943d7e2bb8aa41f15c9b to your computer and use it in GitHub Desktop.

Select an option

Save Sarverott/287690903481943d7e2bb8aa41f15c9b to your computer and use it in GitHub Desktop.
paste it into your browser devtools console to enable options of making current website been converted from HTML to Markdown. it uses Turndown package (https://github.com/mixmark-io/turndown) hosted by https://unpkg.com
const Turndown = ((d,h,u)=>{var x = d.createElement("script", {});x.src=u;h.appendChild(x);return new TurndownService();})(document,document.head,"https://unpkg.com/turndown/dist/turndown.js");
var exporterJSON = (classhookDiv=".CKgc1d")=>JSON.stringify(Array.from(document.querySelectorAll(classhookDiv)).map((x)=>[x.childNodes[0].innerText, Turndown.turndown(x.childNodes[1].innerHTML), x.childNodes[2].data]))
// classhookDiv contains both as first prompting query from user and below it secondly response from LLM that serves answers, as third there is comment element without identified purpose
console.log(exporterJSON())
const Turndown = function(){
var injectScript = document.createElement("script", {});
injectScript.src="https://unpkg.com/turndown/dist/turndown.js";
document.head.appendChild(injectScript);
return new TurndownService();
}();
//inline
const Turndown = ((d,h,u)=>{var x = d.createElement("script", {});x.src=u;h.appendChild(x);return new TurndownService();})(document,document.head,"https://unpkg.com/turndown/dist/turndown.js");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment