LoginSignup
25
27

More than 5 years have passed since last update.

MarkdownをGitHub風のPDFに変換する

Last updated at Posted at 2018-11-30

概要

MarkdownをPDFに変換する。その際、GitHub風の見た目にしたい。

PDFに変換するまでは、VSCodeに拡張を導入するだけで可能。出来上がるPDFをGitHub風の見た目にするためにCSSを入手したり設定ファイルを編集する必要がある。

設定項目

拡張の設定に、任意のCSSを指定する項目がある。

Styles options

CSSの入手

ここから入手できる。

sindresorhus/github-markdown-css: The minimal amount of CSS to replicate the GitHub Markdown style

以下の記事も参考に。

githubのmarkdown-cssをぶっこ抜く方法 - Qiita

適当なエディタを開いて.markdown-を空文字にall-replace(すべて置き換え)する

参考記事内にあるように、事前にCSSに対して上記の編集が必要。

設定の実行

設定を開く→「◯個の設定が見つかりました」のすぐ下にある「…」をクリック→settings.jsonを編集

    // 単なる好み
    "markdown-pdf.displayHeaderFooter": false,
    // github-markdown.cssにすべて任せるので、デフォルトのスタイルを無効化
    "markdown-pdf.includeDefaultStyles": false,
    // 入手したCSSのパスを指定
    "markdown-pdf.styles": [
        "C:\\arbitrary-place\\github-markdown.css"
    ],
25
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
27