Compare commits

...

34 Commits

Author SHA1 Message Date
doew 317f33e33c tiny fix: remove extra backquote on readme.md
It is a typo, probably.
2022-03-22 10:05:38 +01:00
Benedikt Franke b17bc8db68 Pin Docker image versions
Resolves https://github.com/there4/markdown-resume/issues/97

Thanks @emcode
2022-03-18 10:34:35 +01:00
Erik Waibel e5f1703068
Bugfix/docker wkhtml version (#94) 2021-02-22 23:35:17 +01:00
Craig Davis 93fb19daa0
Merge pull request #89 from bebound/master
Set utf8 encoding in docker file config
2019-06-18 18:49:37 -07:00
KK 124b05b869
Set utf8 encoding 2019-06-13 22:16:47 +08:00
Craig Davis bada70bef5
Merge pull request #85 from Kjwon15/fix-template
Update modern template to use newer flex based styling
2019-01-05 09:53:52 -08:00
kjwon15 dc027951e4 Fix template CSS 2019-01-05 19:37:14 +09:00
Craig Davis d4cfc4cdad
Merge pull request #84 from danielklim/danielklim/pdfcommand-arg-passthrough
Pass command line args to wkhtmltopdf to enable better formatting
2018-10-22 10:49:22 -05:00
Daniel Lim 50e7831a08 removed unnecessary comment 2018-10-22 09:12:11 -04:00
Benedikt Franke c5c4f402fc
Update changelog for 2.3.1 2018-10-17 21:41:19 +02:00
danielklim a3e2388724 Docker: Install wkhtmltopdf from vendor to enable inclusion of images (#83)
* wkhtmltopdf from vendor rather than ubuntu upstream

* removing xvfb

* fixed dependency issue for wkhtmltopdf

* Fix formatting, add --no-progress to wget command
2018-10-17 21:29:43 +02:00
Daniel Lim 274b97759f pass command line args to wkhtmltopdf to enable better formatting 2018-10-17 11:08:28 -04:00
Benedikt Franke 6fbb6b4f52
Remove misleading hint to different docker command
Because of #80 the pdf generation inside of docker now works the same.
2018-08-15 17:18:56 +02:00
Benedikt Franke c6e66fd476
Merge pull request #80 from mmarchini/fix-wkhtmltopdf-docker-issue
docker: fix "md2resume pdf" command on docker containers
2018-08-13 10:27:58 +02:00
Matheus Marchini f30371f3eb
docker: fix "md2resume pdf" command on docker containers
The `md2pdf` bash script created during the Docker image build was
invalid. For some reason, it was scrapping out the line break:

```
root@92820d4e9bc1:/resume# cat /usr/bin/md2pdf
```

As a result `md2resume` was failing silently. Also, it was not possible
to run wkhtmltopdf standalone headlessly inside the container. These
changes allow wkhtmltopdf to be run headlessly and fix the issue with
`md2resume pdf`.
2018-08-07 09:55:32 -03:00
Craig Davis 32b76a4a4a
Merge pull request #79 from johnpneumann/77_fix_autoload_path
Fix the ternary operator to set the correct autoloadPath
2018-06-28 07:40:23 -07:00
John P. Neumann e094d7d2dd resolves #77 - fixes the ternary operator to set the correct autoloadPath 2018-06-27 20:05:11 -05:00
spawnia 3c3f269470 Correct md2pdf alias to work non-interactively 2018-04-14 11:57:17 +02:00
spawnia 8dd29e5afd Enable pdf conversion as a oneshot command in docker 2018-04-14 11:17:40 +02:00
spawnia 61524c1702 reformat: Fix readme formatting 2018-03-14 23:02:30 +01:00
Benedikt Franke f9e5f5e2dc
Merge pull request #76 from there4/feat-build-docker-image
feat: Add docker build
2018-03-14 22:07:23 +01:00
spawnia af3a7bfaeb Add docker badge to Readme 2018-03-14 21:58:01 +01:00
spawnia e436420b96 feat: Add docker build
This adds a Dockerfile which builds a Docker image
with all required dependencies included.
It helps to simplify installation and usage of the tool.
2018-03-14 21:51:38 +01:00
Craig Davis 72fba63908
Merge pull request #67 from molecule/master
Update README.md with example pdfs
2017-12-11 15:38:52 -08:00
Molly e6b5f665ed
Update README.md 2017-12-11 15:33:33 -08:00
Molly 3a02ac9f1e
Add outputs built from tool. 2017-12-11 15:31:23 -08:00
Molly 197c117468
Update README.md 2017-12-11 15:08:51 -08:00
Craig Davis 7ecde3ae7b
Merge pull request #66 from asbjornu/feature/path-fixes
Improve path handling when installed via composer.
2017-11-13 15:46:46 -08:00
Asbjørn Ulsberg 48a48ff93a
Direct errors from `git describe` to `/dev/null` 2017-11-13 22:29:33 +01:00
Asbjørn Ulsberg 5f3e5c2b3c
Change back to the current working directory after getting the version 2017-11-13 22:09:59 +01:00
Asbjørn Ulsberg 890080c046
Detect where md2resume is installed and traverse folders accordingly 2017-11-13 22:09:29 +01:00
Asbjørn Ulsberg a35cf4ec07
Output the path to `autoload.php` when exiting due to its non-existance 2017-11-13 21:10:37 +01:00
Craig Davis a1174e1732
Fix incorrect wkhtmltopdf command 2017-10-19 16:59:16 -07:00
Craig Davis 52bd1c19c3
Update README for 2.2.1 build 2017-10-19 16:56:27 -07:00
17 changed files with 624 additions and 325 deletions

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
# Utilize multi-stage build to keep image size down
FROM composer:2.0.4 as composer
COPY composer.* ./
RUN composer install --no-dev --optimize-autoloader --no-progress --no-suggest
# Build the actual image
FROM php:7.1
ENV LC_ALL C.UTF-8
WORKDIR /resume
CMD ["/bin/bash"]
RUN apt-get update \
&& apt-get install -qqy --no-install-recommends \
# This is for enabling the program to be run with watch
procps \
# Required to run PDF generation
wget apt-utils libjpeg62-turbo libxrender1 xfonts-75dpi xfonts-base fontconfig libxext6 \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
RUN cd /root \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_amd64.deb --no-verbose \
&& dpkg -i wkhtmltox_0.12.6-1.stretch_amd64.deb
# Enables continously calling a command and piping the output to STDOUT, viewable via docker logs
RUN printf '#!/bin/bash\nwhile sleep 1; do\n "$@"\ndone' >> /usr/bin/watch-docker \
&& chmod +x /usr/bin/watch-docker
COPY --from=composer /app/vendor /app/vendor
COPY . /app
RUN ln -s /app/bin/md2resume /usr/bin/md2resume

View File

@ -1,9 +1,10 @@
# Markdown Resume Generator [![Build Status](https://travis-ci.org/there4/markdown-resume.png?branch=master)](https://travis-ci.org/there4/markdown-resume)
# Markdown Resume Generator [![Build Status](https://travis-ci.org/there4/markdown-resume.png?branch=master)](https://travis-ci.org/there4/markdown-resume)[![nodesource/node](http://dockeri.co/image/there4/markdown-resume)](https://registry.hub.docker.com/u/there4/markdown-resume/)
> Convert markdown to HTML and PDF resumes
Turn a simple Markdown document into an elegant resume with both a perfect
pdf printable format, and a responsive css3 html5 file. You can view a sample
at the [blog post for the project][blog].
at the [blog post for the project][blog], or look in examples/output to see sample PDFs.
## Features
@ -14,35 +15,49 @@ at the [blog post for the project][blog].
* Single file deployment (no external stylesheets)
* You can now version control and branch your resume.
## Install
## Installation
#### OSX
### Docker
Run those commands in the directory where you put your markdown resume.
#### Oneshot command
This is best suited for use in scripts or in CI environments:
`docker run -v ${PWD}:/resume there4/markdown-resume md2resume [options] command [arguments]`
#### Interactive console
This allows you to enter an interactive console where you can easily experiment and run different commands:
`docker run -it -v ${PWD}:/resume there4/markdown-resume`
### Local
1. Clone the repo `git clone git@github.com:there4/markdown-resume.git` or [Download ZIP](https://github.com/there4/markdown-resume/archive/master.zip)
2. **PHP 7** and **[composer](https://getcomposer.org/download/)** are installed and on your PATH
3. `composer install` inside of the project directory to install dependencies
4. For generating PDF files, you need to install `wkhtmltopdf`
* OSX: `brew cask install wkhtmltopdf` via [Homebrew Cask](https://caskroom.github.io/)
* Debian: `sudo apt install php7.0-mbstring wkhtmltopdf`
* Fedora `sudo dnf install php-mbstring wkhtmltopdf`
## Usage
The two most important commands are the following two. Run them
inside the cloned directory
The simplest installation of the requirements is via [Homebrew Cask](https://caskroom.github.io/)
```bash
brew cask install wkhtmltopdf
```
#### Debian
```bash
sudo apt install php7.0-mbstring wkhtmltopdf
```
#### Fedora
```bash
sudo dnf install php-mbstring wkhtmltopdf
```
## Quickstart
```
./bin/md2resume html examples/source/sample.md examples/output/
./bin/md2resume pdf examples/source/sample.md examples/output/
./bin/md2resume html examples/source/sample.md examples/output/
./bin/md2resume pdf examples/source/sample.md examples/output/
```
## Help
```
Markdown Resume Generator version 2.2.0 by Craig Davis
Markdown Resume Generator version 2.3.0 by Craig Davis
Usage:
[options] command [arguments]
@ -66,25 +81,27 @@ Available commands:
version Show current version information
```
## Examples
Choose a template with the -t option.
`./bin/md2resume html --template blockish examples/source/sample.md examples/output/`
```bash
./bin/md2resume html --template blockish examples/source/sample.md examples/output/
```
If you want to edit your markdown resume in your editor while watching it
update in your browser, run this command:
`watch ./bin/md2resume html --refresh yes --template modern examples/source/sample.md examples/output/`
```bash
watch ./bin/md2resume html --refresh yes --template modern examples/source/sample.md examples/output/
```
This makes the build script run periodically, and html document will refresh
every two seconds via a meta tag. Open the `./examples/ouput/sample.html` file
in your browser, and then just save your markdown document when you want to see
a fresh preview.
For information about running this inside a Docker container, please read [Issue 46](https://github.com/there4/markdown-resume/issues/46#issuecomment-126520792)
where [Sebastian Klose](https://github.com/sklose) has shared his approach.
## Authoring Your Resume
Markdown is limited to basic html markup. Follow the `examples/source/sample.md`
@ -95,15 +112,14 @@ we have very few ways to nest or identify elements that many of the css rules
are based on descendant and adjacent selectors.
## Feature Development
In order to add new commands, you'll need to first install the dependencies:
* `composer install`
In order to add new commands, you'll need to first install the dependencies via `composer install`
After that, you can run the `md2resume_dev.php` file from the command line.
## Building a Release
1. Tag the repo with the new build number.
1. Tag the repo with the new build number.
2. Run `composer build`.
3. Push both the tag and the code.
@ -116,6 +132,8 @@ are a more comfortable with html than markdown, you should use it.
## Changelog
* __2.3.1__ : Fix embedded images in PDF generation with Docker [@danielklim](https://github.com/danielklim)
* __2.3.0__ : Add Docker support to ease the installation process [@spawnia](https://github.com/spawnia)
* __2.2.0__ : Dropped phar file distribution, removed Pake and migrated to composer commands
* __2.1.0__ : Dropped PHP5 support
* __2.0.12__ : Added new `Roboto` template from [@ejwaibel](https://github.com/ejwaibel)
@ -150,4 +168,3 @@ are a more comfortable with html than markdown, you should use it.
[pake]: https://github.com/indeyets/pake/wiki/Installing-Pake
[wkhtmltopdf]: https://github.com/pdfkit/pdfkit/wiki/Installing-WKHTMLTOPDF
[console]: http://symfony.com/doc/current/components/console/introduction.html
HELLO

View File

@ -3,16 +3,22 @@
error_reporting(E_ALL | E_STRICT);
$baseDir = dirname(__DIR__);
$cwd = getcwd();
$templatePath = $baseDir . '/templates';
$consoleTemplatePath = $baseDir . '/src/Resume/Templates';
// When md2resume is used as a dependency with composer, it resides in the
// 'vendor/markdown-resume' directory. This means that the 'autoload.php' is
// actually much higher in the directory tree than is normally expected.
$autoloadPath = (strpos($baseDir, 'vendor')) ? realpath($baseDir . '/../../autoload.php') : $baseDir . '/vendor/autoload.php';
// If the dependencies aren't installed, we have to bail and offer some help.
if (!file_exists($baseDir . '/vendor/autoload.php')) {
exit("\nPlease run `composer install` to install dependencies.\n\n");
if (!file_exists($autoloadPath)) {
exit("\nThe dependency '$autoloadPath' was not found. Please run `composer install` to install dependencies.\n\n");
}
// Bootstrap our application with the Composer autoloader
$app = include $baseDir . '/vendor/autoload.php';
$app = include $autoloadPath;
// Setup the namespace for our own namespace
$app->add('Resume', $baseDir . '/src');
@ -22,8 +28,9 @@ $console = new Resume\Cli\Resume();
// Fetch the version
chdir($baseDir);
$versionCmd = 'git describe --abbrev=0 --tags';
$versionCmd = 'git describe --abbrev=0 --tags 2>/dev/null';
$version = trim(shell_exec($versionCmd));
chdir($cwd);
// Fetch the project name and description
$project = json_decode(file_get_contents(__DIR__ . '/../composer.json'));

View File

@ -36,6 +36,11 @@
"name": "Erik Waibel",
"email": "ejwaibel@gmail.com",
"role": "Contributor"
},
{
"name": "Benedikt Franke",
"email": "benedikt@franke.tech",
"role": "Contributor"
}
],
"support": {

747
composer.lock generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
examples/output/modern.pdf Normal file

Binary file not shown.

Binary file not shown.

BIN
examples/output/swissen.pdf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -31,6 +31,25 @@ class PdfCommand extends HtmlCommand
InputOption::VALUE_REQUIRED,
'Which of the templates to use'
)
->addOption(
'htmlonly',
'H',
InputOption::VALUE_NONE,
'Only render interim HTML (don\'t run wkhtmltopdf)'
)
->addOption(
'keephtml',
'k',
InputOption::VALUE_NONE,
'Keep interim HTML'
)
->addOption(
'pdfargs',
'p',
InputOption::VALUE_REQUIRED,
'Passthrough arguments for wkhtmltopdf',
'--dpi 300 -s Letter'
)
->addOption(
'output',
'o',
@ -48,6 +67,9 @@ class PdfCommand extends HtmlCommand
$template = $input->getOption('template');
$pdfSource = join(DIRECTORY_SEPARATOR, array($destination, '.tmp_pdf_source.html'));
$optFilename = $input->getOption('output');
$htmlonly = $input->getOption('htmlonly');
$keephtml = $input->getOption('keephtml');
$pdfargs = $input->getOption('pdfargs');
$destFilename = join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.pdf'));
@ -82,11 +104,24 @@ class PdfCommand extends HtmlCommand
// Save to a temp destination for the pdf renderer to use
file_put_contents($pdfSource, $rendered);
// command that will be invoked to convert html to pdf
$cmd = "wkhtmltopdf $pdfargs $pdfSource $destFilename";
// Process the document with wkhtmltopdf
exec('wkhtmltopdf --dpi 300' . $pdfSource .' ' . $destFilename);
if(!$htmlonly)
exec($cmd);
// Unlink the temporary file
unlink($pdfSource);
if(!($htmlonly || $keephtml))
unlink($pdfSource);
else
$output->writeln(
sprintf(
"Keeping interim HTML: <info>%s</info>",
$pdfSource
),
$this->app->outputFormat
);
$output->writeln(
sprintf(

View File

@ -53,10 +53,6 @@ body.pdf {
position: absolute;
}
ul li {
width: 33%;
float: left;
}
ul dl {
margin: 0;
padding: 0.3em 0 0;

View File

@ -102,11 +102,13 @@ ul {
margin: 0;
padding: 0;
list-style: none;
display: table;
display: flex;
flex-wrap: wrap
}
ul li {
margin: 0;
padding: 0;
flex-basis: 33%;
}
ul dl {

View File

@ -94,10 +94,6 @@
width: 78%;
}
ul li {
width: 33%;
float: left;
}
ul dl {
dt {
font-size: 122%;
@ -156,4 +152,4 @@
@media screen and (min-width: 118em) {
}
}

View File

@ -51,10 +51,6 @@ body.pdf {
position: absolute;
}
ul li {
width: 33.33%;
float: left;
}
ul dl {
margin: 0;
padding: 0.3em 0 0;

View File

@ -109,11 +109,13 @@ ul {
margin: 0;
padding: 0;
list-style: none;
display: table;
display: flex;
flex-wrap: wrap;
}
ul li {
margin: 0;
padding: 0;
flex-basis: 33%;
}
ul dl {

View File

@ -89,11 +89,6 @@
float: left;
width: 80%;
}
ul li {
width: 33.33%;
float: left;
}
ul dl {
dt {
font-size: 122%;