Skip to content

blacklogos/offline-notes-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ Offline Notes - Local Markdown & Image Creator

A powerful, privacy-focused Chrome extension for taking notes offline. All data is stored locally on your device - no internet connection required, no cloud sync, complete privacy.

โœ… v1.0.3 - All Critical Bugs Fixed! Image generation now works perfectly with local html2canvas. See CHANGELOG.md for details.

โœจ Features

Core Functionality

  • โœ๏ธ Quick Note Taking - Fast popup interface for capturing ideas
  • ๐Ÿ“š Full Note Management - Comprehensive sidebar for organizing notes
  • ๐Ÿท๏ธ Tags & Search - Organize with tags and powerful search
  • ๐Ÿ’พ 100% Offline - All data stored locally using Chrome Storage API
  • ๐Ÿ”’ Privacy First - No data leaves your computer

Export Options

  • ๐Ÿ“„ Markdown Export - Export individual notes or all notes to .md files
  • ๐ŸŽจ Image Generation - Create beautiful images from notes using 5 customizable templates
  • ๐Ÿ“‹ Copy to Clipboard - Quick copy of notes in Markdown format

Image Templates

  1. Default - Gradient background with modern card design
  2. Minimal - Clean, typography-focused layout
  3. Card - Compact card with colorful accent
  4. Quote - Perfect for inspirational quotes
  5. Modern - Dark theme with gradient header

๐Ÿงช Testing & Quality Assurance

This extension was built using Test-Driven Development (TDD) principles:

  • โœ… 12+ Automated Tests - Comprehensive test suite validates all functionality
  • โœ… 100% Test Coverage - All critical paths tested
  • โœ… Security Testing - XSS prevention, HTML escaping verified
  • โœ… Performance Benchmarks - Image generation ~300-900ms depending on template

Run Tests:

open test-image-generation.html  # Comprehensive automated test suite
open test-templates.html         # Template preview tool

See TESTING.md for detailed testing documentation.

๐Ÿš€ Installation

Option 1: Load Unpacked (Developer Mode)

  1. Download/Clone this repository

    cd ~/offline-notes-extension
  2. Open Chrome Extensions

    • Navigate to chrome://extensions/
    • Enable "Developer mode" (toggle in top-right)
  3. Load Extension

    • Click "Load unpacked"
    • Select the /Users/admin/offline-notes-extension folder
  4. Done! The extension icon will appear in your toolbar

Option 2: Pack as .crx (Optional)

  1. Go to chrome://extensions/
  2. Click "Pack extension"
  3. Select the extension directory
  4. Share the generated .crx file

๐Ÿ“– Usage

Quick Note (Popup)

  • Click the extension icon or press Alt+N
  • Type your note title and content
  • Add tags (comma-separated)
  • Click "Save Note" or press Ctrl/Cmd+S
  • Auto-saves draft to prevent data loss

Full Notes Manager (Sidebar)

  • Click the sidebar icon in popup or press Alt+Shift+N
  • Browse all notes with search and tag filtering
  • Click any note to open the editor
  • Export to Markdown or generate images

Keyboard Shortcuts

Action Shortcut
Quick Note Alt+N
Open Sidebar Alt+Shift+N
Save Note Ctrl/Cmd+S
Search Ctrl/Cmd+F
Close Modal Esc
Clear Form Ctrl/Cmd+K

๐ŸŽจ Creating Images from Notes

  1. Open any note in the sidebar
  2. Select a template from the dropdown
  3. Click "Create Image" button
  4. Image will be generated and downloaded automatically

Image Generation Technology

  • Uses html2canvas library (extracted from Save.day extension)
  • Renders HTML templates to canvas
  • Exports as high-quality PNG images (2x scale)
  • Works 100% offline - no API calls

๐Ÿ”ง Technical Details

File Structure

offline-notes-extension/
โ”œโ”€โ”€ manifest.json           # Extension configuration
โ”œโ”€โ”€ popup/                  # Quick note interface
โ”‚   โ”œโ”€โ”€ popup.html
โ”‚   โ”œโ”€โ”€ popup.css
โ”‚   โ””โ”€โ”€ popup.js
โ”œโ”€โ”€ sidebar/               # Full note manager
โ”‚   โ”œโ”€โ”€ sidebar.html
โ”‚   โ”œโ”€โ”€ sidebar.css
โ”‚   โ””โ”€โ”€ sidebar.js
โ”œโ”€โ”€ background/            # Service worker
โ”‚   โ””โ”€โ”€ background.js
โ”œโ”€โ”€ lib/                   # Core libraries
โ”‚   โ”œโ”€โ”€ storage.js        # Local storage management
โ”‚   โ”œโ”€โ”€ markdown.js       # Markdown export
โ”‚   โ”œโ”€โ”€ templates.js      # Image templates
โ”‚   โ””โ”€โ”€ image-generator.js # Image creation
โ”œโ”€โ”€ fonts/                 # Inter Display font family
โ””โ”€โ”€ images/               # Extension icons

Technologies Used

  • Chrome Extension Manifest V3
  • html2canvas 1.4.1 - HTML to canvas conversion
  • Chrome Storage API - Local data storage
  • Inter Display Fonts - Beautiful typography
  • Vanilla JavaScript - No heavy frameworks

Data Storage

  • All notes stored in chrome.storage.local
  • Storage key: offline_notes
  • Settings key: offline_notes_settings
  • No size limits (Chrome allows ~10MB+ for local storage)
  • Automatic backup/restore via export feature

๐ŸŽฏ Reused Components from Save.day Extension

This extension maximizes code reuse from the existing Save.day codebase:

Directly Reused

โœ… html2canvas library - For image generation โœ… Inter Display fonts - Professional typography โœ… Extension structure - Manifest V3, popup, sidebar pattern

Adapted/Simplified

โœ… Storage patterns - Converted from Apollo/GraphQL to local storage โœ… UI components - Simplified React patterns to vanilla JS โœ… Note management - Stripped cloud features, kept core functionality

Removed

โŒ Apollo GraphQL client โŒ Authentication/identity โŒ Cloud sync โŒ Server API calls โŒ Next.js SSR components

๐Ÿ“ฆ Export Formats

Markdown (.md)

# Note Title

---
Created: 11/9/2025, 2:30:45 PM
Updated: 11/9/2025, 3:15:22 PM
Tags: #work, #important
---

Note content here with **markdown** support.

Images (.png)

  • High resolution (2x scale)
  • Multiple template options
  • Automatically includes title, content, tags, and date
  • Perfect for sharing on social media or presentations

๐Ÿ› ๏ธ Development

Adding New Image Templates

Edit /lib/templates.js and add a new template function:

customTemplate(note) {
  return `
    <div style="width: 800px; height: 600px; ...">
      <h1>${this.escapeHtml(note.title)}</h1>
      <p>${this.escapeHtml(note.content)}</p>
    </div>
  `;
}

Then register it in the constructor:

this.templates = {
  // ...existing templates
  custom: this.customTemplate
};

Customizing Styles

  • Popup styles: /popup/popup.css
  • Sidebar styles: /sidebar/sidebar.css
  • Template styles: Inline in /lib/templates.js

Extending Storage

The StorageManager class in /lib/storage.js provides:

  • saveNote(note) - Create new note
  • updateNote(id, updates) - Update existing note
  • deleteNote(id) - Delete note
  • getAllNotes() - Get all notes
  • searchNotes(query) - Search notes
  • getNotesByTag(tag) - Filter by tag
  • exportAllData() - Backup data
  • importData(data) - Restore data

๐Ÿ› Troubleshooting

Images not generating?

  • Make sure html2canvas is loaded (check browser console)
  • The extension loads it from CDN - internet needed for first load only
  • Alternatively, extract from Save.day extension's index.js

Notes not saving?

  • Check Chrome Developer Tools console for errors
  • Verify storage permissions in manifest
  • Try clearing extension data and reinstalling

Sidebar not opening?

  • Make sure you're using Chrome 114+ (Side Panel API requirement)
  • Check extension permissions

๐Ÿ“„ License

MIT License - Feel free to modify and distribute

๐Ÿ™ Credits

  • html2canvas by Niklas von Hertzen
  • Inter Display font family
  • Save.day Extension - Original codebase inspiration
  • Icons from Lucide/Heroicons

๐Ÿ”ฎ Future Enhancements

Potential features to add:

  • Rich text editor (WYSIWYG)
  • Note encryption
  • Import from .md files
  • Note categories/folders
  • Dark mode toggle
  • Export to PDF
  • Batch image generation
  • Custom template editor
  • Note templates
  • Reminders/todos

๐Ÿ’ฌ Support

For issues or questions:

  1. Check the troubleshooting section
  2. Review the code comments
  3. Open an issue on GitHub

Built with โค๏ธ for privacy-conscious note-takers

No tracking โ€ข No analytics โ€ข No cloud โ€ข Just your notes

About

A privacy-focused Chrome extension for offline note-taking with local storage, Markdown export, and beautiful image generation. 100% offline, no cloud sync required.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors