Skip to content

Commit

Permalink
➕ Add line end option support
Browse files Browse the repository at this point in the history
  • Loading branch information
northy committed Sep 10, 2020
1 parent 6e77cef commit 055bdb6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
| source_md | 'source.md' | Source Markdown File | Yes |
| output_md | 'README.md' | Output Markdown File (CAN be the same file as the input) | No |
| root_folder | '' | Change root output folder (useful for github pages) | No |
| line_end | '---\n' | Appends line end to every image line on markdown | No |
### Inspired from:
* [Blog post workflow](https://github.com/gautamkrishnar/blog-post-workflow)
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
description: "Output markdown file"
default: 'README.md'
required: false
line_end:
description: "Line end"
default: '---\n'
required: false

branding:
icon: 'activity'
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ wget -q -O split.py https://raw.githubusercontent.com/northy/pdf-to-markdown-wor

echo "Running split.py"

python split.py "${INPUT_PDF_INPUT}" "${INPUT_OUTPUT_FOLDER}" "${INPUT_SOURCE_MD}" "${INPUT_OUTPUT_MD}" "${INPUT_ROOT_FOLDER}"
python split.py "${INPUT_PDF_INPUT}" "${INPUT_OUTPUT_FOLDER}" "${INPUT_SOURCE_MD}" "${INPUT_OUTPUT_MD}" "${INPUT_ROOT_FOLDER}" "${INPUT_LINE_END}"

rm split.py

Expand Down
3 changes: 2 additions & 1 deletion split.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
source_md = sys.argv[3]
output_md = sys.argv[4]
output_folder_root = sys.argv[5]+output_folder
line_end = sys.argv[6].replace('\\n','\n')

if not os.path.exists(output_folder_root):
os.makedirs(output_folder_root)
Expand All @@ -31,7 +32,7 @@
pix = page.getPixmap()
output = f"{output_folder}/page{i}.png"
output_root = f"{output_folder_root}/page{i}.png"
imgs.append(f'![Page {i}]({output} "Page {i}")\n---\n')
imgs.append(f'![Page {i}]({output} "Page {i}")\n{line_end}')
pix.writePNG(output_root)
except :
break
Expand Down

0 comments on commit 055bdb6

Please sign in to comment.