Skip to content

Implement Google Docs badge insertion system with markdown filtering for wikiGDrive indicators#588

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/fix-587
Draft

Implement Google Docs badge insertion system with markdown filtering for wikiGDrive indicators#588
Copilot wants to merge 5 commits intomasterfrom
copilot/fix-587

Conversation

Copy link
Copy Markdown

Copilot AI commented Sep 6, 2025

This PR introduces a comprehensive badge system that inserts unobtrusive indicators directly into Google Documents processed by wikiGDrive. The badges behave like GitHub README shields: lightweight visual tokens containing links or status indicators that authors can reposition anywhere in their documents. Badges are automatically filtered out during markdown conversion to ensure they only appear in Google Docs and never in the final wiki output.

WikiGDrive Badge System Demo

Key Features

Google Docs Integration: Badges are inserted directly into Google Documents using the Google Docs API, allowing editors to see and interact with them while working in Google Docs.

Four Initial Badge Types:

  • Last Processed Badge: Shows timestamp with color-coded freshness (✅ green for recent, ⚠️ orange for stale, ❌ red for very old)
  • Preview Link Badge: Direct link to the rendered wiki page (👁️ icon)
  • Table of Contents Badge: Links to collection/TOC entry (📋 icon)
  • Duplicate Alert Badge: Warning indicator when document duplicates are detected (⚠️ orange)

Author-Friendly: The entire badge container can be cut/pasted to any location in the document without breaking functionality. Badges are deterministic - they update existing badges rather than creating duplicates during reprocessing.

Clean Markdown Output: Badges are automatically filtered out during ODT to markdown conversion, ensuring the final wiki output contains only content without any badge artifacts.

Technical Implementation

The badge system integrates at the document fetch stage in TaskFetchDocument.ts, using the Google Docs API to insert badges directly into Google Documents before they are downloaded as ODT files. A postprocessing filter automatically removes badge markers during markdown conversion to prevent badges from appearing in the final output.

Core Components:

  • GoogleDocsService: Handles Google Docs API interactions for content insertion and updates
  • DocsBadgeInserter: Generates badge content and coordinates insertion into Google Documents
  • removeBadgeMarkers: Postprocessing filter that removes badge sections during markdown conversion
  • Integration Point: Badge insertion in TaskFetchDocument before ODT download, badge removal in postProcess.ts

Configuration Options:

badge_config:
  enabled: true
  base_url: "https://wiki.example.com"
  wiki_url: "https://wiki.example.com"
  toc_url: "https://wiki.example.com/toc"

Badge Format in Google Docs:

📍 WikiGDrive Badges: ✅ 2h ago 👁️ Preview 📋 Table of Contents 📍 End Badges

The markers (📍 WikiGDrive Badges: and 📍 End Badges) help the system identify and update existing badges without creating duplicates, while allowing users to reposition the entire badge block anywhere in their document. These markers are automatically detected and removed during markdown conversion.

The implementation includes comprehensive documentation (docs/google-docs-badge-system.md) explaining the user workflow and technical architecture.

Fixes #587.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Copy Markdown
Author

Copilot AI commented Sep 6, 2025

@horner 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 2 commits September 6, 2025 21:14
Co-authored-by: horner <6094599+horner@users.noreply.github.com>
Co-authored-by: horner <6094599+horner@users.noreply.github.com>
Copilot AI changed the title [WIP] Introduce extensible badge system for wikiGDrive indicators in Google Docs Implement extensible badge system for wikiGDrive indicators in Google Docs Sep 6, 2025
Copilot AI requested a review from horner September 6, 2025 21:22
@horner
Copy link
Copy Markdown
Member

horner commented Sep 7, 2025

@copilot it looks like you entirely missed the point of the ticket. The badges should be inserted into the Google Document for the benefit of the editor acting in Google Doc.

@horner
Copy link
Copy Markdown
Member

horner commented Sep 7, 2025

The badges should absolutely not show up in the markdown. Only in the google doc. I feel like you need to start over. @copilot

Co-authored-by: horner <6094599+horner@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Sep 7, 2025

@copilot it looks like you entirely missed the point of the ticket. The badges should be inserted into the Google Document for the benefit of the editor acting in Google Doc.

You're absolutely right - I completely misunderstood the requirement. I've now implemented the proper solution that inserts badges directly into Google Documents using the Google Docs API.

Key changes in commit d066123:

New Implementation:

  • GoogleDocsService: Uses Google Docs API to insert/update content in documents
  • DocsBadgeInserter: Generates badge content and manages insertion into Google Docs
  • Integration in TaskFetchDocument: Badges are inserted before ODT download

User Experience:

  • Badges appear as repositionable text in Google Docs: 📍 WikiGDrive Badges: ✅ 2h ago 👁️ Preview 📋 Table of Contents 📍 End Badges
  • Authors can cut/paste badges anywhere in the document
  • System preserves badge position during updates by finding existing markers

Removed: Previous incorrect implementation that only added badges to markdown output

The badges are now inserted directly into Google Documents where editors can see and interact with them, exactly as specified in issue #587.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.deno.land
    • Triggering command: curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Implement extensible badge system for wikiGDrive indicators in Google Docs Implement Google Docs badge insertion system for wikiGDrive indicators Sep 7, 2025
Co-authored-by: horner <6094599+horner@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Sep 7, 2025

The badges should absolutely not show up in the markdown. Only in the google doc. I feel like you need to start over. @copilot

You're absolutely right! I've now fixed the implementation to ensure badges only appear in Google Docs and are completely filtered out of the markdown output.

The Issue: Badges were being inserted into Google Documents, but then appearing in the markdown because the ODT conversion naturally included them.

The Solution (commit 6d2f7e9):

  • Added removeBadgeMarkers.ts that automatically detects and removes badge sections during markdown conversion
  • Badges remain visible to editors in Google Docs for repositioning and status updates
  • Final markdown output is completely clean with no badge content

The workflow now works exactly as requested:

  1. Badges appear in Google Docs for editors to see and reposition
  2. During conversion to markdown, badge markers are automatically filtered out
  3. Final wiki output contains no badge content whatsoever

This gives editors the visual indicators they need in Google Docs while keeping the markdown output focused purely on content.

Copilot AI changed the title Implement Google Docs badge insertion system for wikiGDrive indicators Implement Google Docs badge insertion system with markdown filtering for wikiGDrive indicators Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Introduce extensible badge system for wikiGDrive indicators in Google Docs

3 participants