Markdown-pdf

Markdown PDF Viewer

Markdown PDF Viewer icon

Chrome Web Store

日本語 / English

日本語

Markdown PDF Viewer は、GitHub 上の Markdown を、ワンクリックでPDF風に表示・印刷できる Chrome / Edge 拡張機能です。

設計メモ、研究資料、FPGA関連ドキュメント、技術仕様書など、Markdownで管理している資料を見やすく確認・印刷するためのツールです。

こんな人におすすめ

サンプル

日本語サンプルプレビュー

機能

インストール

開発用インストール

  1. Chrome または Edge を開きます。
  2. chrome://extensions または edge://extensions を開きます。
  3. デベロッパーモードを有効にします。
  4. パッケージ化されていない拡張機能を読み込む を選びます。
  5. このリポジトリ内の extension/ フォルダを選択します。

ファイルを変更した後は、拡張機能ページで拡張機能を再読み込みし、対象のMarkdownページも再読み込みしてください。

使い方

GitHubのMarkdownページを開きます。

https://github.com/nagito-hiroshima/Markdown-pdf/blob/main/samples/sample-document.md

ページ上部に追加される PDF表示 ボタンを押します。

Raw URLでも同じように使えます。

https://raw.githubusercontent.com/nagito-hiroshima/Markdown-pdf/refs/heads/main/samples/sample-document.md

拡張機能アイコンをクリックすると、現在のタブ、手入力URL、ローカル .md ファイルからも開けます。

構成

パス 役割
extension/ Chrome / Edge 拡張機能本体
extension/manifest.json Chrome拡張の設定
extension/_locales/ 日本語・英語の翻訳
extension/i18n.js 拡張機能画面の翻訳適用
extension/background.js content script から依頼されたビューアタブを開く
extension/content-script.js GitHub Markdownページにボタンを追加
extension/popup.html / extension/popup.js / extension/popup.css 拡張機能ポップアップ
extension/viewer.html / extension/viewer.js / extension/viewer.css PDF風Markdownビューア
.github/workflows/validate.yml 検証用GitHub Actions
.github/workflows/release.yml 自動リリース用GitHub Actions
architecture.md 要件・設計メモ

検証

node --check extension/background.js
node --check extension/content-script.js
node --check extension/i18n.js
node --check extension/markdown.js
node --check extension/popup.js
node --check extension/viewer.js
node -e "JSON.parse(require('fs').readFileSync('extension/manifest.json','utf8'))"

リリース

タグをpushすると、GitHub Actionsが配布パッケージ内の extension/manifest.jsonversion をタグに合わせてから、配布用zipを作成してReleaseを公開します。

git tag v1.0.0
git push origin v1.0.0

GitHubのActions画面から Release ワークフローを手動実行することもできます。その場合も v1.0.0 のようなタグ名を指定してください。

配布zipは、展開したフォルダの直下に manifest.json が見える形で作成されます。

English

Markdown PDF Viewer is a Chrome / Edge extension that opens Markdown files from GitHub or GitHub Raw URLs in a clean, PDF-style browser preview.

It is intended for design notes, research documents, FPGA documentation, technical specifications, and other Markdown-based documents that need to be reviewed or printed neatly.

Sample

English sample preview

Features

Install for Development

  1. Open Chrome or Edge.
  2. Go to chrome://extensions or edge://extensions.
  3. Enable developer mode.
  4. Choose Load unpacked.
  5. Select the extension/ folder in this repository.

After changing files, reload the extension from the extensions page and then reload the target Markdown page.

Usage

Open a Markdown file on GitHub.

https://github.com/nagito-hiroshima/Markdown-pdf/blob/main/samples/sample-document-en.md

Use the buttons added near the top of the page.

Raw URLs work the same way.

https://raw.githubusercontent.com/nagito-hiroshima/Markdown-pdf/refs/heads/main/samples/sample-document-en.md

You can also use the extension popup to open the current tab, enter a Markdown URL manually, or open a local .md file.

Project Files

Path Purpose
extension/ Chrome / Edge extension source
extension/manifest.json Chrome extension manifest
extension/_locales/ English and Japanese translations
extension/i18n.js Applies translations in extension pages
extension/background.js Opens viewer tabs from content scripts
extension/content-script.js Adds page buttons to GitHub Markdown pages
extension/popup.html / extension/popup.js / extension/popup.css Extension popup UI
extension/viewer.html / extension/viewer.js / extension/viewer.css PDF-style Markdown viewer
.github/workflows/validate.yml Validation GitHub Actions workflow
.github/workflows/release.yml Automated release GitHub Actions workflow
architecture.md Architecture and requirements notes

Development Checks

node --check extension/background.js
node --check extension/content-script.js
node --check extension/i18n.js
node --check extension/markdown.js
node --check extension/popup.js
node --check extension/viewer.js
node -e "JSON.parse(require('fs').readFileSync('extension/manifest.json','utf8'))"

Release

When you push a release tag, GitHub Actions updates the packaged extension/manifest.json version to match the tag, creates a release zip, and publishes a GitHub Release.

git tag v1.0.0
git push origin v1.0.0

You can also run the Release workflow manually from the GitHub Actions page. Use a tag name such as v1.0.0.

The release zip is created so that manifest.json is directly visible at the extracted folder root.

Onboarding and first run

When the extension is installed for the first time, it opens onboarding.html once. The page explains how to open GitHub Markdown, use the on-page PDF View button, open URLs or local files from the extension icon, and save the rendered document as PDF from the browser print dialog. It also includes Japanese/English language buttons and a sample Markdown button.

Sample workflow:

  1. Open the sample: https://github.com/nagito-hiroshima/Markdown-pdf/blob/main/samples/sample-document.md.
  2. Click the PDF View button added to the GitHub Markdown page, or open the extension popup and click Open Sample.
  3. Click Print in the viewer.
  4. Choose Save as PDF in the browser print screen.

Supported URLs

The extension accepts these URL types:

GitHub blob URLs are converted to raw GitHub URLs before the viewer fetches the file.

Unsupported URLs

The extension intentionally does not pass these pages to the viewer:

If the current GitHub page is not a Markdown file, the popup shows: “Open a Markdown file (.md) on GitHub before using this extension.”

Troubleshooting fetch errors

The viewer no longer displays only the browser’s raw Failed to fetch message. Markdown fetching is performed in the Manifest V3 service worker and errors are classified as invalid URL, unsupported URL, network error, timeout, HTTP error, not found, access denied, not Markdown, or too large.

If fetching fails, check the following:

Private GitHub repositories

Private GitHub repositories are not currently supported for remote fetching. The extension fetches Markdown with credentials: "omit", so GitHub authentication cookies are not sent. Download the file locally and use Open Local Markdown if you need to render private content.

Permissions

The extension requests activeTab to inspect the current tab URL from the popup and storage to pass local Markdown content to the viewer. Host permissions include GitHub, raw GitHub, and HTTP/HTTPS URLs because the popup supports user-entered Markdown URLs outside GitHub; the service worker validates schemes, rejects credentialed URLs, follows redirects carefully, and blocks HTML responses before rendering.