Skip to main content

Markdown Viewer - File tree + Live preview + Hot reload

Project description

MDV - Markdown Viewer

ファイルツリー + ライブプレビュー + ファイルブラウザ機能付きマークダウンビューア

Features

  • 📁 左側にフォルダツリー表示
  • 📄 マークダウンをHTMLでレンダリング
  • 🔄 ファイル更新時に自動リロード(WebSocket)
  • 🎨 シンタックスハイライト(highlight.js)
  • 📊 Mermaid図のレンダリング対応
  • 🌙 ダーク/ライトテーマ切り替え
  • ✏️ インラインエディタ(Cmd+E)
  • 📥 PDF出力(Cmd+P)
  • 🎬 動画/音声プレビュー

ファイルブラウザ機能

  • 右クリックコンテキストメニュー
    • ファイル:開く、ダウンロード、名前変更、パスコピー、削除
    • フォルダ:新規フォルダ、アップロード、名前変更、パスコピー、削除
  • ドラッグ&ドロップ
    • ファイル/フォルダをフォルダへ移動
    • 外部ファイルをドロップしてアップロード
  • キーボードショートカット
    • Delete/Backspace:選択アイテムを削除
    • F2:名前変更

Installation

# PyPIからインストール(推奨)
pip install mdv-live

# または開発版をインストール
git clone https://github.com/panhouse/mdv.git
cd mdv
pip install -e .

Usage

# カレントディレクトリを表示
mdv

# 特定のディレクトリを表示
mdv ./project/

# 特定のファイルを開く
mdv README.md

# ポート指定
mdv -p 9000

# ブラウザを自動で開かない
mdv --no-browser

# MarkdownをPDFに変換
mdv --pdf README.md
mdv --pdf README.md -o output.pdf

# サーバー管理
mdv -l        # 稼働中のサーバー一覧
mdv -k -a     # 全サーバー停止
mdv -k <PID>  # 特定サーバー停止

Keyboard Shortcuts

ショートカット 機能
Cmd/Ctrl + B サイドバー表示切替
Cmd/Ctrl + E 編集モード切替
Cmd/Ctrl + S 保存(編集モード時)
Cmd/Ctrl + P PDF出力
Cmd/Ctrl + W タブを閉じる
Delete/Backspace ファイル/フォルダ削除
F2 名前変更

Architecture

mdv/
├── __init__.py           # バージョン管理
├── __main__.py           # エントリポイント
├── cli.py                # CLIオプション・PDF変換
├── server.py             # FastAPIルート定義・オーケストレーション
├── models.py             # Pydanticモデル
├── file_types.py         # ファイルタイプ判定(レジストリパターン)
├── state.py              # アプリケーション状態管理
├── websocket_manager.py  # WebSocket接続管理
├── rendering.py          # Markdown/コードレンダリング
├── file_tree.py          # ファイルツリー構築
├── path_security.py      # パス検証・セキュリティ
├── file_response.py      # APIレスポンス生成
├── media_streaming.py    # メディアストリーミング(Range対応)
├── watcher.py            # ファイル監視(ポーリング)
└── static/
    ├── index.html        # HTMLテンプレート
    ├── styles.css        # CSSスタイル
    └── app.js            # JavaScriptアプリ

Requirements

  • Python 3.9+
  • FastAPI
  • uvicorn
  • markdown-it-py
  • python-multipart

Advanced: macOS Finder Integration

macOSで.mdファイルをダブルクリックしてMDVで開けるようにする設定です。

セットアップスクリプトを使用(推奨)

# mdvがインストールされていることを確認
which mdv

# セットアップスクリプトを実行
curl -fsSL https://raw.githubusercontent.com/panhouse/mdv/main/scripts/setup-macos-app.sh | bash

または、リポジトリをクローンしている場合:

./scripts/setup-macos-app.sh

手動セットアップ

クリックして展開
  1. mdvのパスを確認:
which mdv
# 例: /usr/local/bin/mdv
  1. AppleScriptファイルを作成(~/MDV.applescript):
on open theFiles
    repeat with theFile in theFiles
        set filePath to POSIX path of theFile
        -- ↓ 自分のmdvパスに置き換える
        do shell script "nohup /usr/local/bin/mdv " & quoted form of filePath & " > /dev/null 2>&1 &"
    end repeat
end open

on run
    display dialog "MDV Markdown Viewer" buttons {"OK"} default button "OK"
end run
  1. アプリにコンパイル:
osacompile -o /tmp/MDV.app ~/MDV.applescript
  1. Info.plistを設定(/tmp/MDV.app/Contents/Info.plist):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleIdentifier</key>
    <string>com.mdv.viewer</string>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>Markdown Document</string>
            <key>CFBundleTypeRole</key>
            <string>Viewer</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>net.daringfireball.markdown</string>
            </array>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>md</string>
                <string>markdown</string>
            </array>
        </dict>
    </array>
    <key>CFBundleExecutable</key>
    <string>droplet</string>
    <key>CFBundleName</key>
    <string>MDV</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
</dict>
</plist>
  1. 署名してインストール:
codesign --force --deep --sign - /tmp/MDV.app
sudo mv /tmp/MDV.app /Applications/
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/MDV.app

デフォルトアプリに設定

  1. Finderで任意の.mdファイルを右クリック
  2. 「情報を見る」を選択
  3. 「このアプリケーションで開く」で「MDV」を選択
  4. 「すべてを変更...」をクリック

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdv_live-0.2.9.tar.gz (48.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdv_live-0.2.9-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file mdv_live-0.2.9.tar.gz.

File metadata

  • Download URL: mdv_live-0.2.9.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for mdv_live-0.2.9.tar.gz
Algorithm Hash digest
SHA256 743b032bbe148f6fb54ff83f9b30e15dec23553a4be9cb8c36b57fe11e9bf4ff
MD5 4d7eeea25d78460cbbbd85131268044a
BLAKE2b-256 16f9699a5d30f6d879b5c9a74ff6ba2b1e06c6f73b7a1d4522e24760c602eeaa

See more details on using hashes here.

File details

Details for the file mdv_live-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: mdv_live-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for mdv_live-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1228b392436f293fbb50a9e3c11b77b918527039a0de3ee9bec33b0ab5b8f307
MD5 6f1d56045a8671f4d96dbc575301881d
BLAKE2b-256 44ce5cbd6e5b9e1f680f4a8f1f1ff9b4bfbf5f24cfea441a9bd0fe758233e534

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page