diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 89f1eaa..4cdb729 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -125,8 +125,8 @@ jobs:
# Verify combined PDF
test -f _site/docs.pdf || (echo "Missing docs.pdf" && exit 1)
- # Verify single preview image for combined PDF
- test -f _site/preview.png || (echo "Missing preview.png" && exit 1)
+ # Verify single preview image for combined PDF (derived from PDF name)
+ test -f _site/docs.png || (echo "Missing docs.png" && exit 1)
# Verify .md links were rewritten to .html
if grep -q '\.md"' _site/docs/index.html; then
@@ -319,20 +319,20 @@ jobs:
body += `**Single-file mode (test-output-single):**\n`;
body += `- resume.pdf\n`;
body += `- index.html\n`;
- body += `- preview.png\n\n`;
+ body += `- resume.png\n\n`;
body += `**Combined mode (test-output-combined):**\n`;
body += `- docs.pdf (combined)\n`;
body += `- index.html (auto-generated index)\n`;
body += `- docs/*.html (individual pages)\n`;
- body += `- preview.png\n\n`;
+ body += `- docs.png\n\n`;
body += `**Collection mode - flat (test-output-collection-flat):**\n`;
body += `- resume.pdf, cover-letter.pdf, references.pdf\n`;
body += `- resume.html, cover-letter.html, references.html\n`;
- body += `- *-preview.png (one per document)\n\n`;
+ body += `- *.png (one per document)\n\n`;
body += `**Collection mode - nested (test-output-collection-nested):**\n`;
body += `- projects/web/*.pdf, projects/mobile/*.pdf\n`;
body += `- projects/web/*.html, projects/mobile/*.html\n`;
- body += `- *-preview.png (one per document)\n`;
+ body += `- *.png (one per document)\n`;
await github.rest.issues.createComment({
owner: context.repo.owner,
diff --git a/action.yml b/action.yml
index 90c679c..c4c4f96 100644
--- a/action.yml
+++ b/action.yml
@@ -23,9 +23,9 @@ inputs:
required: false
default: 'index.html'
output-preview:
- description: 'Output preview image filename (without extension)'
+ description: 'Output preview image filename (without extension). Defaults to PDF name if not set.'
required: false
- default: 'preview'
+ default: ''
preview-dpi:
description: 'Preview image resolution in DPI'
required: false
@@ -166,7 +166,13 @@ runs:
BASE_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
fi
- PREVIEW_URL="${BASE_URL}/${{ inputs.output-preview }}.png"
+ PDF_NAME="${{ inputs.output-pdf }}"
+ PREVIEW_NAME="${{ inputs.output-preview }}"
+ if [ -z "$PREVIEW_NAME" ]; then
+ PREVIEW_NAME="${PDF_NAME%.pdf}"
+ fi
+
+ PREVIEW_URL="${BASE_URL}/${PREVIEW_NAME}.png"
PAGE_URL="${BASE_URL}/"
cat > /tmp/og-header.html << 'HEADER_EOF'
@@ -182,8 +188,8 @@ runs:
--include-in-header=/tmp/og-header.html \
--lua-filter="${{ github.action_path }}/filters/mdlinks-to-html.lua"
- - name: Generate HTML pages (multi-file mode)
- if: ${{ inputs.sources != '' }}
+ - name: Generate HTML pages (multi-file combined mode)
+ if: ${{ inputs.sources != '' && inputs.mode == 'combined' }}
shell: bash
run: |
set -euo pipefail
@@ -195,7 +201,13 @@ runs:
BASE_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
fi
- PREVIEW_URL="${BASE_URL}/${{ inputs.output-preview }}.png"
+ PDF_NAME="${{ inputs.output-pdf }}"
+ PREVIEW_NAME="${{ inputs.output-preview }}"
+ if [ -z "$PREVIEW_NAME" ]; then
+ PREVIEW_NAME="${PDF_NAME%.pdf}"
+ fi
+
+ PREVIEW_URL="${BASE_URL}/${PREVIEW_NAME}.png"
PAGE_URL="${BASE_URL}/"
cat > /tmp/og-header.html << 'HEADER_EOF'
@@ -218,6 +230,40 @@ runs:
--lua-filter="${{ github.action_path }}/filters/mdlinks-to-html.lua"
done < /tmp/mdpress_files.txt
+ - name: Generate HTML pages (multi-file collection mode)
+ if: ${{ inputs.sources != '' && inputs.mode == 'collection' }}
+ shell: bash
+ run: |
+ set -euo pipefail
+
+ REPO_NAME="${{ github.event.repository.name }}"
+ if [ "${{ github.repository_owner }}" = "${{ github.event.repository.name }}" ]; then
+ BASE_URL="https://${{ github.repository_owner }}.github.io"
+ else
+ BASE_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
+ fi
+
+ while IFS= read -r SRC; do
+ REL="${SRC#./}"
+ DEST="_site/${REL%.md}.html"
+ PREVIEW_URL="${BASE_URL}/${REL%.md}.png"
+ PAGE_URL="${BASE_URL}/${REL%.md}.html"
+ mkdir -p "$(dirname "$DEST")"
+
+ cat > /tmp/og-header.html << HEADER_EOF
+
+
+
+
+
+ HEADER_EOF
+
+ echo "Converting $SRC -> $DEST"
+ pandoc -s "$SRC" -o "$DEST" \
+ --include-in-header=/tmp/og-header.html \
+ --lua-filter="${{ github.action_path }}/filters/mdlinks-to-html.lua"
+ done < /tmp/mdpress_files.txt
+
- name: Generate index page (multi-file mode, combined)
if: ${{ inputs.sources != '' && inputs.mode == 'combined' }}
shell: bash
@@ -284,7 +330,13 @@ runs:
- name: Generate preview image (single-file or combined mode)
if: ${{ inputs.sources == '' || inputs.mode == 'combined' }}
shell: bash
- run: pdftoppm "_site/${{ inputs.output-pdf }}" "_site/${{ inputs.output-preview }}" -png -singlefile -rx ${{ inputs.preview-dpi }} -ry ${{ inputs.preview-dpi }}
+ run: |
+ PDF_NAME="${{ inputs.output-pdf }}"
+ PREVIEW_NAME="${{ inputs.output-preview }}"
+ if [ -z "$PREVIEW_NAME" ]; then
+ PREVIEW_NAME="${PDF_NAME%.pdf}"
+ fi
+ pdftoppm "_site/$PDF_NAME" "_site/$PREVIEW_NAME" -png -singlefile -rx ${{ inputs.preview-dpi }} -ry ${{ inputs.preview-dpi }}
- name: Generate preview images (collection mode)
if: ${{ inputs.sources != '' && inputs.mode == 'collection' }}
diff --git a/docs/configuration.md b/docs/configuration.md
index c9864df..5817dfe 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -8,7 +8,7 @@
| `sources` | Space or newline separated list of Markdown files or glob patterns (multi-file mode) | — |
| `output-pdf` | Output PDF filename | `document.pdf` |
| `output-html` | Output HTML filename | `index.html` |
-| `output-preview` | Output preview image filename (without extension) | `preview` |
+| `output-preview` | Output preview image filename (without extension) | PDF name |
| `preview-dpi` | Preview image resolution in DPI | `150` |
| `mode` | Multi-file mode: `combined` (single PDF) or `collection` (separate PDFs) | `combined` |
| `index-title` | Title for auto-generated index page (multi-file mode) | `Index` |