Skip to content

atyou2happy/TabBitBrowser-Chat-Export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TabBit Chat Export

中文文档

License: MIT Chrome Manifest V3 Zero Dependencies

A lightweight Chrome extension that exports TabBitBrowser AI chat conversations to Markdown with one click.

Features

  • One-Click Copy — Copy the entire conversation (all questions + answers) to clipboard as Markdown
  • Markdown Preview — Preview the generated Markdown before copying
  • Download as .md — Save the conversation as a .md file
  • Multi-Turn Support — Handles multi-turn conversations correctly
  • Robust Extraction — 3-layer DOM parsing fallback strategy for reliable extraction
  • Zero Dependencies — Pure vanilla JavaScript, no external libraries required (~580 lines total)

Installation

Prerequisites

  • Google Chrome or any Chromium-based browser (Edge, Arc, Brave, etc.)
  • TabBitBrowser account with access to chat pages

Steps

  1. Clone the repository

    git clone https://github.com/zccyman/TabBitBrowser-Chat-Export.git
  2. Open Chrome Extensions page — Navigate to chrome://extensions/

  3. Enable Developer Mode — Toggle the Developer mode switch in the top-right corner

  4. Load the extension — Click Load unpacked and select the tabbit-chat-export/ subfolder (containing manifest.json)

  5. Pin the extension (optional) — Click the puzzle piece icon in the toolbar, find TabBit Chat Export, and pin it

Usage

  1. Open TabBitBrowser and navigate to a chat page (/chat/{uuid})
  2. Click the TabBit Chat Export icon in the Chrome toolbar
  3. Use the popup to:
    • Copy — Copies all conversation as Markdown to clipboard
    • Preview — Shows a preview of the Markdown output
    • Download — Saves the conversation as a .md file

Project Structure

TabBitBrowser-Chat-Export/
├── LICENSE                  # MIT License
├── README.md                # English documentation
├── README_CN.md             # Chinese documentation
└── tabbit-chat-export/      # Extension source code
    ├── manifest.json        # Chrome Manifest V3 config
    ├── content.js           # Content script — 3-layer DOM extraction engine
    ├── popup.html           # Popup UI (inline CSS)
    ├── popup.js             # Popup logic — extraction, clipboard, download
    ├── styles.css           # Content script styles (floating button, notifications)
    └── icon.png             # Extension icon

Technical Details

DOM Extraction Strategy

TabBitBrowser is built with Next.js + React Server Components (RSC). Each message container has explicit data-message-type ("user" / "assistant") and data-message-index attributes. The extension uses a 3-layer extraction strategy:

Layer Strategy Description
1 Message Type Attribute Queries [data-message-type] elements, sorts by data-message-index
2 ActionBar Anchor Finds AI responses via [data-message-action-bar], walks to [data-message-type] container, pairs with preceding user message
3 User Bubble + ActionBar Locates .theme-user-message for user messages and [data-message-action-bar] for AI responses, sorts by page position

Permissions

Permission Reason
activeTab Access the current tab's DOM for extraction
scripting Inject content script when automatic injection fails
*://*.tabbitbrowser.com/* Only operates on TabBitBrowser domains

Content Script Injection

The extension uses a robust 3-stage injection strategy:

  1. Attempts to communicate with an already-injected content script via ping
  2. Falls back to chrome.scripting.executeScript for manual injection
  3. Final fallback executes extraction directly in the page context via executeScript with inline function

Development

git clone https://github.com/zccyman/TabBitBrowser-Chat-Export.git
cd TabBitBrowser-Chat-Export
# Edit source files, then reload extension in chrome://extensions/

Debugging

  • Popup: Right-click extension icon → "Inspect popup"
  • Content script: DevTools → Console on the chat page
  • Extension errors: Check chrome://extensions/ for error logs

FAQ

"No conversation found"

  • Ensure the page has fully loaded before clicking the extension
  • Verify the URL contains /chat/ (the extension only works on chat pages)
  • Try refreshing the page and clicking again

"Please use on TabBitBrowser chat page"

  • The extension only works on https://web.tabbitbrowser.com/chat/* pages
  • Navigate to a chat conversation first, then click the extension

Content script injection failed

  • Check that the extension has host permissions for tabbitbrowser.com
  • Try removing and re-loading the extension
  • Check the DevTools console for errors

License

MIT © 2026 zccyman

About

A Chrome extension (Manifest V3) that exports TabBitBrowser AI chat conversations to Markdown with one click. Features 3-layer DOM extraction, clipboard copy, preview, and .md download.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages