Skip to content

Commit d25c72e

Browse files
committed
Create action that converts markdown docs to PDF with pandoc
1 parent 3ef0dcf commit d25c72e

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.github/workflows/md-to-pdf.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Markdown to PDF
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
convert_via_pandoc:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: Create file list
11+
id: files_list
12+
run: |
13+
echo "files=$(printf '\"%s\" ' *.md | sed 's/ \"sidebar\.md\"/ /' && printf '\"%s\" ' extensions/*.md)" > $GITHUB_OUTPUT
14+
mkdir output
15+
- uses: docker://pandoc/extra:latest-ubuntu
16+
with:
17+
args: >-
18+
--output=output/aseprite-docs.pdf ${{ steps.files_list.outputs.files }}
19+
--pdf-engine=lualatex
20+
-f markdown_github
21+
--include-in-header ./.github/workflows/pdf/header.tex
22+
--include-before-body ./.github/workflows/pdf/title.tex
23+
--file-scope
24+
--table-of-contents
25+
--number-sections
26+
-V mainfont="DejaVu Sans"
27+
-V mainfontoptions:"Extension=.ttf, UprightFont=*, BoldFont=*-Bold"
28+
-V documentclass=article
29+
-V colorlinks
30+
-V urlcolor=NavyBlue
31+
-V geometry:"top=2cm, bottom=1.5cm, left=2cm, right=2cm"
32+
- uses: actions/upload-artifact@master
33+
with:
34+
name: aseprite-docs
35+
path: output/aseprite-docs.pdf

.github/workflows/pdf/header.tex

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
\usepackage{listings}
2+
\usepackage{fancyhdr}
3+
\pagestyle{fancy}
4+
\title{Aseprite Documentation}
5+
\setkeys{Gin}{scale=1, height=0.4\textheight, keepaspectratio}
6+
\let\verbatim\undefined\let\verbatimend\undefined\lstnewenvironment{verbatim}{\lstset{breaklines}}{}

.github/workflows/pdf/title.tex

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
\date{\today}
2+
\maketitle
3+
\lhead{Aseprite Documentation}
4+
\rhead{\today}

0 commit comments

Comments
 (0)