Skip to content

nk468399773-sys/Python-Markdown-Viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Viewer

A lightweight Windows-oriented Markdown viewer built with tkinter, tkinterdnd2, and tkhtmlview.

It supports live preview, drag-and-drop opening, recent files, a popup settings panel, and basic text selection/copy interactions.

Features

  • Open local .md files from the File menu
  • Drag and drop Markdown files into the window
  • Auto-reload when the current file changes on disk
  • Restore the last opened file on next launch
  • Keep up to 5 recent file paths
  • Popup settings window for:
    • font size
    • line height
    • window opacity
    • always-on-top
  • Markdown support for:
    • headings
    • paragraphs
    • line breaks
    • tables
    • fenced code blocks
    • simple unordered lists
  • Text interaction support:
    • select text
    • Ctrl+C copy
    • Ctrl+A select all
    • Esc clear selection
    • double-click to select a word
    • triple-click to select a line
    • right-click context menu

Requirements

  • Windows
  • Python 3.11 or compatible Python 3 version

Install

Install dependencies in the project directory:

pip install -r requirements.txt

If you want to use a specific Python executable:

& 'C:\Users\ASUS\AppData\Local\Programs\Python\Python311\python.exe' -m pip install -r requirements.txt

Run

python main.py

Or with the explicit Python path:

& 'C:\Users\ASUS\AppData\Local\Programs\Python\Python311\python.exe' main.py

Usage

Open a file

  • Click File -> Open File
  • Or drag a .md file into the viewer window

Recent files

  • Click File -> Recent Files
  • The app stores up to 5 recent paths
  • The last opened file is restored automatically at startup if it still exists

Settings

Click Settings to open the popup panel and adjust:

  • Font Size
  • Line Height
  • Opacity
  • Always On Top

Settings are saved to config.json at runtime.

Keyboard And Mouse Shortcuts

  • Ctrl+C: Copy selected text
  • Ctrl+A: Select all text
  • Esc: Clear selection
  • Double-click: Select word
  • Triple-click: Select current line
  • Right-click: Open context menu

Project Structure

  • main.py: main window, file watching, menus, selection and copy behavior
  • settings.py: persistent app settings and recent file storage
  • theme.py: HTML post-processing for code blocks, lists, and wrapped content
  • config.json: saved runtime configuration
  • requirements.txt: Python dependencies

Notes

  • This project uses tkhtmlview, so some HTML/CSS behavior is intentionally simplified.
  • Code blocks and unordered lists are post-processed in Python to improve rendering consistency.
  • Recent file paths are stored as plain strings in config.json.

About

带置顶的markdown阅读器。

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages