GithubHelp home page GithubHelp logo

mdgpt's Introduction

MdGPT

Welcome to MarkdownGPT or MdGPT. This nifty little bookmark lets you save your chats to markdown so you can insert it into markdown apps like obsidian.

Instructions:

  1. Create a new bookmark in your browser.
  2. Edit the bookmark's URL field and replace its value with the following code:
javascript:(function() {
  function h(html) {
    return html.replace(/<p>/g, '\n\n').replace(/<\/p>/g, '').replace(/<b>/g, '**').replace(/<\/b>/g, '**').replace(/<i>/g, '_').replace(/<\/i>/g, '_').replace(/<code[^>]*>/g, (match) => {
      const lm = match.match(/class="[^"]*language-([^"]*)"/);
      return lm ? '\n```' + lm[1] + '\n' : '```';
    }).replace(/<\/code[^>]*>/g, '```').replace(/<[^>]*>/g, '').replace(/Copy code/g, '').replace(/This content may violate our content policy. If you believe this to be in error, please submit your feedback โ€” your input will aid our research in this area./g, '').trim();
  }
  const e = document.querySelectorAll(".text-base");
  let t = "";
  for (const s of e) {
    if (s.querySelector(".whitespace-pre-wrap")) {
      t += t == "" ? "" : "--------\n";
      t += `**${s.querySelectorAll('img').length > 1 ? s.querySelectorAll('img')[1].alt : 'ChatGPT'}**: ${h(s.querySelector(".whitespace-pre-wrap").innerHTML)}\n\n`;
    }
  }
  const o = document.createElement("a");
  o.download = (document.querySelector(".pr-14.bg-gray-800")?.innerText || "Conversation with ChatGPT") + ".md";
  o.href = URL.createObjectURL(new Blob([t]));
  o.style.display = "none";
  document.body.appendChild(o);
  o.click();
})();
  1. Save the bookmark.
  2. Open a page that contains a conversation with ChatGPT.
  3. Click the bookmark to run the code and download the conversation as a Markdown file.

mdgpt's People

Contributors

donjikong avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.