Compare commits
34 Commits
Author | SHA1 | Date |
---|---|---|
doew | 317f33e33c | |
Benedikt Franke | b17bc8db68 | |
Erik Waibel | e5f1703068 | |
Craig Davis | 93fb19daa0 | |
KK | 124b05b869 | |
Craig Davis | bada70bef5 | |
kjwon15 | dc027951e4 | |
Craig Davis | d4cfc4cdad | |
Daniel Lim | 50e7831a08 | |
Benedikt Franke | c5c4f402fc | |
danielklim | a3e2388724 | |
Daniel Lim | 274b97759f | |
Benedikt Franke | 6fbb6b4f52 | |
Benedikt Franke | c6e66fd476 | |
Matheus Marchini | f30371f3eb | |
Craig Davis | 32b76a4a4a | |
John P. Neumann | e094d7d2dd | |
spawnia | 3c3f269470 | |
spawnia | 8dd29e5afd | |
spawnia | 61524c1702 | |
Benedikt Franke | f9e5f5e2dc | |
spawnia | af3a7bfaeb | |
spawnia | e436420b96 | |
Craig Davis | 72fba63908 | |
Molly | e6b5f665ed | |
Molly | 3a02ac9f1e | |
Molly | 197c117468 | |
Craig Davis | 7ecde3ae7b | |
Asbjørn Ulsberg | 48a48ff93a | |
Asbjørn Ulsberg | 5f3e5c2b3c | |
Asbjørn Ulsberg | 890080c046 | |
Asbjørn Ulsberg | a35cf4ec07 | |
Craig Davis | a1174e1732 | |
Craig Davis | 52bd1c19c3 |
|
@ -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
|
83
README.md
83
README.md
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
"name": "Erik Waibel",
|
||||
"email": "ejwaibel@gmail.com",
|
||||
"role": "Contributor"
|
||||
},
|
||||
{
|
||||
"name": "Benedikt Franke",
|
||||
"email": "benedikt@franke.tech",
|
||||
"role": "Contributor"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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(
|
||||
|
|
|
@ -53,10 +53,6 @@ body.pdf {
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
ul li {
|
||||
width: 33%;
|
||||
float: left;
|
||||
}
|
||||
ul dl {
|
||||
margin: 0;
|
||||
padding: 0.3em 0 0;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,10 +51,6 @@ body.pdf {
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
ul li {
|
||||
width: 33.33%;
|
||||
float: left;
|
||||
}
|
||||
ul dl {
|
||||
margin: 0;
|
||||
padding: 0.3em 0 0;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -89,11 +89,6 @@
|
|||
float: left;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
ul li {
|
||||
width: 33.33%;
|
||||
float: left;
|
||||
}
|
||||
ul dl {
|
||||
dt {
|
||||
font-size: 122%;
|
||||
|
|
Loading…
Reference in New Issue