Skip to content

Ayoobf/JAMViewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JAMViewer

Just A Markdown Viewer - A lightweight, native macOS application for viewing and monitoring Markdown files in real-time.

Overview

JAMViewer just reads and renders markdown files... nothing more, nothing less. It automatically monitors your files for changes and updates the view in real-time, making it perfect for previewing Markdown while you write.

image

Features

  • Real-Time File Monitoring: Automatically updates when your Markdown file changes
  • Command Line Support: Open files directly from Terminal (JAMViewer file.md)
  • Drag & Drop: Drag Markdown files onto the app to view them
  • Keyboard Shortcuts:
    • ⌘O - Open file
    • ⌘+ or ⌘= - Increase font size
    • ⌘- - Decrease font size
    • ⌘0 - Reset font size
  • Beautiful Typography: Custom styled headings, code blocks, and blockquotes
  • Code Highlighting: Monospace font (Menlo) with background highlighting for code blocks
  • Dark Mode Support: Automatically adapts to light and dark mode
  • Native macOS App: Built with SwiftUI for optimal performance

Requirements

  • macOS 12.0+
  • Xcode 14.0+ (for building from source)

Installation

Building from Source

  1. Clone this repository
  2. Open JAMViewer.xcodeproj in Xcode
  3. Add MarkdownUI via Swift Package Manager:
    • File → Add Package Dependencies...
    • Enter: https://github.com/gonzalezreal/swift-markdown-ui
  4. Build and run (⌘R)

Usage

Opening Files

There are multiple ways to open Markdown files:

  1. File Menu: Launch the app and use ⌘O or File → Open File...
  2. Command Line: open -a JAMViewer path/to/file.md
  3. Drag & Drop: Drag a .md file onto the app icon or window
  4. Default App: Set JAMViewer as the default app for .md files

Viewing Markdown

Once a file is open, JAMViewer will:

  • Display the rendered Markdown with styled typography
  • Automatically refresh when the file is saved or modified
  • Maintain your preferred font size across sessions

Architecture

JAMViewer is built with a clean SwiftUI architecture:

  • JAMViewerApp.swift: Main app entry point with file opening and command-line handling
  • ContentView.swift: Main view displaying rendered Markdown
  • MarkdownRenderer.swift: Custom Markdown rendering component with styled typography
  • FileManagerModel.swift: Observable model managing file selection state
  • FileMonitor.swift: File system monitoring using Grand Central Dispatch
  • FontSizeKeyboardShortcuts.swift: Custom keyboard shortcut handling for font size
  • EmptyStateView.swift: Placeholder views for various states (empty, loading, error)

Typography Scale

The app uses a proportional typography scale based on the adjustable base font size:

  • Body Text: Base font size (default: 16pt)
  • H1: 2.0× base size
  • H2: 1.5× base size with underline
  • H3: 1.17× base size
  • Code: 0.9× base size in Menlo font

Visual Styling

  • Code Blocks: Menlo font with background fill and rounded borders
  • Headings: Bold/semibold weights with appropriate spacing
  • Blockquotes: Blue left border accent with indentation

Supported Markdown Elements

  • Headings (H1, H2, H3)
  • Paragraphs with bold and italic text
  • Code blocks with syntax highlighting background
  • Inline code snippets
  • Blockquotes
  • Ordered and unordered lists
  • Links
  • Images
  • Tables
  • And more via MarkdownUI

Technology Stack

  • SwiftUI: Modern declarative UI framework
  • MarkdownUI: Powerful Markdown rendering library
  • Grand Central Dispatch: Efficient file system monitoring
  • AppKit: Native macOS integration

Contributing

Contributions are welcome! Feel free to:

  • Report bugs or request features via Issues
  • Submit pull requests with improvements
  • Suggest enhancements to the viewer or styling

License

MIT LICENSE

About

Just A Markdown (JAM) Viewer

Resources

License

Stars

Watchers

Forks

Packages

No packages published