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.10.tar.gz (49.2 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.10-py3-none-any.whl (52.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mdv_live-0.2.10.tar.gz
  • Upload date:
  • Size: 49.2 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.10.tar.gz
Algorithm Hash digest
SHA256 05a4d683917eb368d197489c76088d1dd5e157543d42abd6d5801d52ef560d68
MD5 9f5c0808512b72bf017624880d83da11
BLAKE2b-256 844ddd9174335fa018a7edf5629b487ea037944574738b6bfde7417b71bf5d30

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mdv_live-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 52.0 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a849606d4f78fb5b2586e2bc835d620995713fc7d13d19b4ab0bb48a5daeb03c
MD5 b4675383b7ca74ea99c6ed470cbb348e
BLAKE2b-256 7a4f18276dccb98c6962bf4d02a649fac22e9ad6d6c2d5326b7eee226d3490a3

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