Skip to content

Instantly share code, notes, and snippets.

@craftdelivery
Created May 27, 2019 14:41
Show Gist options
  • Save craftdelivery/9ed0898aa9b5f7b2d69fd0dccf18ae23 to your computer and use it in GitHub Desktop.
Save craftdelivery/9ed0898aa9b5f7b2d69fd0dccf18ae23 to your computer and use it in GitHub Desktop.
resgen

pandoc resume generator

Generates a unique looking PDF from markdown

Hyperlinks may not be obvious so its best to put the urls in plain text in an appendix or bottom section (in case the end user prints it out)

requirements

pandoc 1.17.0

This script depends on an older version of pandoc:

https://pandoc.org/releases.html#pandoc-1.17.0.3-24-mar-2016

unzip and follow instructions

mactex (for Mac)

brew install mactex

usage

./gen.sh inputfile

outfile

{inputfile}.pdf

#/bin/bash
# install pandoc 1.17.0: https://pandoc.org/releases.html#pandoc-1.17.0.3-24-mar-2016
# mac: brew cask install mactex
mtxrun --generate
pandoc "$1" --from markdown --to context --latex-engine=xelatex --template style.tex -V A4 --standalone -o "$1.pdf"
% Copyright 2013 Christophe-Marie Duquesne <chmd@chmd.fr>
% Copyright 2014 Mark Szepieniec <http://github.com/mszep>
%
% ConText style for making a resume with pandoc. Inspired by moderncv.
%
% This CSS document is delivered to you under the CC BY-SA 3.0 License.
% https://creativecommons.org/licenses/by-sa/3.0/deed.en_US
% modified Eli Tabello \definecolor with color templates to be replaced: %%col%%
\startmode[*mkii]
\enableregime[utf-8]
\setupcolors[state=start]
\stopmode
$if(mainlang)$
\mainlanguage[$mainlang$]
$endif$
\setupcolor[hex]
\definecolor[titlecolor][h=%%titleC%%]
\definecolor[sectioncolor][h=%%sectionC%%]
\definecolor[rulecolor][h=%%ruleC%%]
% Enable hyperlinks
\setupinteraction[state=start, color=sectioncolor]
\setuppapersize [$if(papersize)$$papersize$$else$letter$endif$][$if(papersize)$$papersize$$else$letter$endif$]
\setuplayout [width=middle, height=middle,
backspace=20mm, cutspace=0mm,
topspace=10mm, bottomspace=20mm,
header=0mm, footer=0mm]
%\setuppagenumbering[location={footer,center}]
\setupbodyfont[11pt, helvetica]
\setupwhitespace[medium]
\setupblackrules[width=31mm, color=rulecolor]
\setuphead[chapter] [style=\tfd]
\setuphead[section] [style=\tfd\bf, color=titlecolor, align=middle]
\setuphead[subsection] [style=\tfb\bf, color=sectioncolor, align=right,
before={\leavevmode\blackrule\hspace}]
\setuphead[subsubsection][style=\bf]
$if(number-sections)$
$else$
\setuphead[chapter, section, subsection, subsubsection][number=no]
$endif$
%\setupdescriptions[width=10mm]
\definedescription
[description]
[headstyle=bold, style=normal,
location=hanging, width=18mm, distance=14mm, margin=0cm]
\setupitemize[autointro, packed] % prevent orphan list intro
\setupitemize[indentnext=no]
\setupfloat[figure][default={here,nonumber}]
\setupfloat[table][default={here,nonumber}]
\setuptables[textwidth=max, HL=none]
\setupthinrules[width=15em] % width of horizontal rules
\setupdelimitedtext
[blockquote]
[before={\setupalign[middle]},
indentnext=no,
]
$if(toc)$
\setupcombinedlist[content][list={$placelist$}]
$endif$
$for(header-includes)$
$header-includes$
$endfor$
\starttext
$if(title)$
\startalignment[center]
\blank[2*big]
{\tfd $title$}
$if(author)$
\blank[3*medium]
{\tfa $for(author)$$author$$sep$\crlf $endfor$}
$endif$
$if(date)$
\blank[2*medium]
{\tfa $date$}
$endif$
\blank[3*medium]
\stopalignment
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\placecontent
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
\stoptext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment