Skip to content

Commit

Permalink
feat: added more features (#24)
Browse files Browse the repository at this point in the history
* Make build_timeout customizable
* build_timeout is customizable now
* Added manual workflow execution
* Added Logging and wait for DOM instead of Network (500ms)
* Testing some issues regarding URI lengths
* {{{title}}} in template will now be used :)
* Added theme extension
* Formatted code & moved 'pdf built' message
* README now contains information for the new property
* Some formatting & prevention of reading of docker secrets
* Updated dependency 'cheerio'
because of a vulnerability in a dependency of cheerio
* Restructured project
* Wrong node version (null-coalescing operator not implemented yet)
* Removed vulnerable package 'markdown-it-named-headers'
* 'await' only available in 'async' functions
* Removed default settings because of errors on GitHub
* Now uses the old slugify function again
* Integrated automatic TOC generation
* Action option 'table_of_contents' will now be used…
* Removed weird merge artifact…
* Updated Names For Merge

Co-authored-by: Neo Hornberger <[email protected]>
  • Loading branch information
JohnMeyerhoff and neo-hornberger authored Jul 15, 2021
1 parent 9489885 commit efc04d3
Show file tree
Hide file tree
Showing 11 changed files with 3,206 additions and 3,023 deletions.
102 changes: 51 additions & 51 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,56 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- name: Build the docker image
run: |
export TAG=${GITHUB_SHA:0:8}
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml build
if: github.ref == 'refs/heads/master' || contains(github.ref,'bdc_')
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: branch Push Docker image to github package registry
run: |
export TAG=${GITHUB_SHA:0:8}
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml push
if: github.ref == 'refs/heads/master' || contains(github.ref,'bdc_')
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v1
- name: Build the docker image
run: |
export TAG=${GITHUB_SHA:0:8}
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml build
if: github.ref == 'refs/heads/master' || contains(github.ref,'bdc_')
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: branch Push Docker image to github package registry
run: |
export TAG=${GITHUB_SHA:0:8}
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml push
if: github.ref == 'refs/heads/master' || contains(github.ref,'bdc_')
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

- name: Build the docker image with latest tag
run: |
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml build
if: github.ref == 'refs/heads/master'
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Build the docker image with latest tag
run: |
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml build
if: github.ref == 'refs/heads/master'
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

- name: branch Push Docker image to github package registry with latest tag
run: |
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml push
if: github.ref == 'refs/heads/master'
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Build the docker image with latest tag for dockerhub
run: |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
docker-compose -f docker-compose-dockerhub.yaml build
if: github.ref == 'refs/heads/master'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: branch Push Docker image to dockerhub registry with latest tag
run: |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
docker-compose -f docker-compose-dockerhub.yaml push
if: github.ref == 'refs/heads/master'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: branch Push Docker image to github package registry with latest tag
run: |
echo "$DOCKER_PASSWORD" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f docker-compose.yaml push
if: github.ref == 'refs/heads/master'
env:
DOCKER_USERNAME: ${{ github.repository }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Build the docker image with latest tag for dockerhub
run: |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
docker-compose -f docker-compose-dockerhub.yaml build
if: github.ref == 'refs/heads/master'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: branch Push Docker image to dockerhub registry with latest tag
run: |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
docker-compose -f docker-compose-dockerhub.yaml push
if: github.ref == 'refs/heads/master'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ RUN apt-get update && \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget curl && \
rm -rf /var/lib/apt/lists/*

COPY markdown-to-pdf.js /
COPY src/*.js /
COPY package.json /
COPY template/ template/
COPY styles/ styles/

RUN npm install
RUN fc-cache -fv && \
chmod +x /markdown-to-pdf.js && \
chmod +x /github_interface.js && \
mkdir /pdf && \
chmod 777 /pdf && \
ln -s /markdown-to-pdf.js /usr/local/bin/markdown-to-pdf
ln -s /github_interface.js /usr/local/bin/markdown-to-pdf

CMD [ "markdown-to-pdf" ]
50 changes: 36 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Markdown to PDF
[![CI](https://github.com/TwoHorus/markdown-to-pdf/actions/workflows/main.yml/badge.svg)](https://github.com/TwoHorus/markdown-to-pdf/actions/workflows/main.yml)
This is a Hotfix!
[![CI](https://github.com/BaileyJM02/markdown-to-pdf/actions/workflows/main.yml/badge.svg)](https://github.com/BaileyJM02/markdown-to-pdf/actions/workflows/main.yml)

Creates PDF and HTML files from Markdown using the GitHub (or custom) theme.

Expand All @@ -17,7 +16,7 @@ Creates PDF and HTML files from Markdown using the GitHub (or custom) theme.

```yaml
with:
input_dir: value
input_dir: value
```
(**Required**)
Expand All @@ -28,17 +27,18 @@ The location of the folder containing your .md or .markdown files.
```yaml
with:
images_dir: value
images_dir: value
```
([Path](#path))
The location of the folder containing your images, this should be the route of all images. So of you had images located at `images/about/file.png` and `images/something-else/file.png` you would pass the value `images`.
The location of the folder containing your images, this should be the route of all images. So of you had images located
at `images/about/file.png` and `images/something-else/file.png` you would pass the value `images`.

### Output Directory

```yaml
with:
output_dir: value
output_dir: value
```

([Path](#path))
Expand All @@ -48,17 +48,19 @@ The location of the folder you want to place the built files.

```yaml
with:
image_import: value
image_import: value
```

([String](#string))
The path you use to import your images that can be replaced with the server URL. For example if you had `<img src="./images/something-else/file.">` you would pass `./images` as this is replaced by `https://localhost:3000` during the build process.
The path you use to import your images that can be replaced with the server URL. For example if you
had `<img src="./images/something-else/file.">` you would pass `./images` as this is replaced
by `https://localhost:3000` during the build process.

### Build HTML

```yaml
with:
build_html: value
build_html: value
```

([Boolean](#boolean))
Expand All @@ -68,17 +70,25 @@ Whether to also create a .html file.

```yaml
with:
theme: value
theme: value
```

([File](#file))
The location of the CSS file you want to use as the theme.

```yaml
with:
extend_default_theme: value
```

([Boolean](#boolean))
Whether to extend your custom CSS file with the default theme

### Highlight CSS Theme

```yaml
with:
highlight_theme: value
highlight_theme: value
```

([File](#file))
Expand All @@ -88,19 +98,30 @@ The location of the CSS file you want to use as the code snipped highlight theme

```yaml
with:
template: value
template: value
```

([File](#file))
The location of the HTML/Mustache file you want to use as the HTML template.

### Table Of Contents

```yaml
with:
table_of_contents: value
```

([Boolean](#boolean))
Whether a table of contents should be generated

## Input Types

A few pieces to describe what input each value expects.

### Path

A path will most likely be from your repository's route, it should not be prefixed or suffixed with a `/`. The path should look like so `docs/topic/featureDocs` or `writing/category`.
A path will most likely be from your repository's route, it should not be prefixed or suffixed with a `/`. The path
should look like so `docs/topic/featureDocs` or `writing/category`.

### String

Expand Down Expand Up @@ -156,4 +177,5 @@ jobs:

## Contributions

Any contributions are helpful, please make a pull-request. If you would like to discuses a new feature, please create an issue first.
Any contributions are helpful, please make a pull-request. If you would like to discuses a new feature, please create an
issue first.
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 'Markdown to PDF and HTML'
description: 'Creates PDF and HTML files from Markdown using the GitHub (or custom) theme.'
runs:
using: 'docker'
image: 'docker://baileyjm02/markdown-to-pdf:latest'
image: 'docker://twohorus/markdown-to-pdf:latest'

inputs:
input_dir:
Expand Down Expand Up @@ -33,6 +33,9 @@ inputs:
template:
description: '(File) The location of the HTML/Mustache file you want to use as the HTML template'
required: false
table_of_contents:
description: '(Boolean) Whether a table of contents should be generated'
required: false

branding:
icon: 'book'
Expand Down
Loading

0 comments on commit efc04d3

Please sign in to comment.