Closed HannesWuensche closed 2 years ago
I am facing the same issue.
Error:
/usr/bin/docker run --name baileyjm02markdowntopdflatest_140dcb --label 8a33c1 --workdir /github/workspace --rm -e INPUT_INPUT_DIR -e INPUT_OUTPUT_DIR -e INPUT_IMAGES_DIR -e INPUT_IMAGE_IMPORT -e INPUT_BUILD_HTML -e INPUT_THEME -e INPUT_HIGHLIGHT_THEME -e INPUT_TEMPLATE -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/ru...
Started image server with image folder route '/github/workspace/assets'.
Markdown files found: lectures.md
(node:1) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/github/workspace/mainlectures.md'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at GetFileBody (/markdown-to-pdf.js:113:12)
at /markdown-to-pdf.js:267:21
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
My yaml file:
# .github/workflows/convert-to-pdf.yml
name: MD to PDF HTML
# This workflow is triggered on pushes to the repository.
on:
push:
branches:
- master
# Paths can be used to only trigger actions when you have edited certain files, such as a file within the listed directory
jobs:
converttopdf:
name: Build PDF
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: baileyjm02/markdown-to-pdf@v1
with:
input_dir: main
output_dir: dist
images_dir: assets
# for example <img src="./images/file-name.png">
image_import: ../assets
# Default is true, can set to false to only get PDF files
build_html: false
- uses: actions/upload-artifact@v1
with:
name: dist
path: dist
My md file is inside main directory:
@alok722 Please use input_dir: main/
for now. The seems to fix your issue. @HannesWuensche, could you try using just a single slash instead of a dot, or an empty string.
input_dir: /
input_dir: ""
@BaileyJM02 Thank you for your fast response! (and thank you in general for the tool)
input_dir: ""
does not work saying:
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined
at GetMarkdownFiles (/markdown-to-pdf.js:68:15)
at /markdown-to-pdf.js:254:17
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
input_dir: /
does work, but the resulting .pdf layout is scrambled: Generated PDF in my Repro
I see, please leave it with me, I'll have to investigate more over the weekend 👍
@alok722 Please use
input_dir: main/
for now. The seems to fix your issue. @HannesWuensche, could you try using just a single slash instead of a dot, or an empty string.
input_dir: /
input_dir: ""
This I tried myself after seeing the source code but I am facing trouble in linking my image folder specifically what to write in image_import: value , My images are stored in /assets/all_imagefiles.png
@alok722 The image_import setting should be set to the part of the relative path to an image, that describes the path from the input_dir to the image directory.
For example:
Input directory
main/
Images
assets/image1.png
assets/image2.png
Image usage in MD file
![First image](../assets/image1.png)
![Second image](../assets/image2.png)
Image import setting
../assets/
I think we can now close this issue.
Indeed this has been resolved, but I'm leaving this open until a pull request from @neo-hornberger includes the updated README file. Also waiting on #29.
After half a year, I just opened a pull request including the updated README file and the input_dir
fix.
He, since end of last week I get the following Error Message:
My .yml:
Since my "input_dir" is root but can not be empty I set it to ".". Worked till last week. Obviously the "." causes the Problem:
Thank you