マークダウンからPDF変換ツールについて

マークダウンからPDFに変換できるツールがあります。oscpの試験レポートにも使えるので、インストールの仕方を整理しました。環境はmacを想定しています。

セットアップ手順

1.OSCPの試験レポート生成ツールをダウンロード
https://github.com/noraj/OSCP-Exam-Report-Template-Markdown
sudo git clone https://github.com/whoisflynn/OSCP-Exam-Report-Template.git

2.マークダウンをpdfに変換するテンプレートをダウンロード
https://github.com/Wandmalfarbe/pandoc-latex-template
sudo git clone https://github.com/Wandmalfarbe/pandoc-latex-template

2-1./Users/USERNAME/.pandoc/templates/のフォルダを生成
mkdir -p /Users/USERNAME/.pandoc/templates/

2-2.「eisvogel.tex」を「eisvogel.html」にリネームして、「/Users/USERNAME/.pandoc/templates/」配下に移動
mv eisvogel.tex eisvogel.html
mv eisvogel.html /Users/USERNAME/.pandoc/templates/

2-3. 必要に応じて不足パッケージをインストール
sudo tlmgr install adjustbox babel-german background bidi collectbox csquotes everypage filehook footmisc footnotebackref framed fvextra letltxmacro ly1 mdframed mweights needspace pagecolor sourcecodepro sourcesanspro titling ucharcat ulem unicode-math upquote xecjk xurl zref

3.pandocをインストール
https://pandoc.org/installing.html

3-1.「Download the latest installer for macOS」を押下

3-2. インストーラーを起動して、手順に従ってインストール

3-3. aliasを設定する
echo “alias pandoc=’/Users/USERNAME/anaconda3/bin/pandoc'” >> .zprofile


4. TeX Liveをインストール
http://www.tug.org/texlive/acquire-netinstall.html

4-1.以下にアクセスしてファイルをダウンロードhttp://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz

4-2. 「install-tl-unx.tar.gz」を解凍

4-3. 以下のコマンドでインストールする
sudo /Users/USERNAME/Downloads/install-tl-20201230\ 2/install-tl

5.p7zipをインストール
sudo brew install p7zip

実行

1.テンプレートのファイルを必要に応じて編集
cd ~/opt/OSCP-Exam-Report-Template-Markdown/src
vi OSCP-exam-report-template_whoisflynn_v3.2.md

2.「OSCP-Exam-Report-Template-Markdown」のディレクトリに移動
cd ~/opt/OSCP-Exam-Report-Template-Markdown

3.スクリプトの実行
sudo ruby generate.rb

4.生成されたファイルを確認(以下のディレクトリに生成される)
cd ~/opt/OSCP-Exam-Report-Template-Markdown/output