Generate your CV in HTML, PDF and DOCX with Asciidoc

The following is a simple workflow for generating your CV in HTML, PDF and DOCX formats using a single Asciidoc file, a CSS stylesheet and a DOCX or ODT template.

Sample files

  1. Click to view the CV (opens a new tab) here:
  2. Clone the sample files from the GitHub repo:
  3. Click on the links below to download the sample files directly:

Short version

  1. Asciidoc to HTML:
    asciidoctor -a nofooter -a stylesheet=yourCV.css yourCV.adoc
    
  2. HTML to PDF:
    wkhtmltopdf yourCV.html yourCV.pdf
    
  3. HTML to DOCX:
    pandoc -o yourCV.docx --reference-docx=refCV.docx yourCV.html
    

Guided version

  1. Install Asciidoc, Asciidoctor, Pandoc and wkhtmltopdf.
    Here's how to do it on a Ubuntu Linux machine:
    sudo apt install asciidoc asciidoctor pandoc wkhtmltopdf
    
  2. Create a new directory:
    mkdir yourCV
    
  3. Fire up your favourite text editor.
    The open-source (and awesome!) Atom text editor has some nifty packages (plugins) for Asciidoc, including Asciidoc Preview, which gives you a rendered HTML preview within the editor, and the Asciidoc Language Package, which provides Asciidoc syntax highlighting.
  4. Write your CV in a text file.
    The syntax for Asciidoc (see Asciidoctor's Writer's Guide) is simple and similar to that of Markdown. You can either write your CV from scratch, download the sample Asciidoc file above or clone all the files from this Github repository:
    git clone https://github.com/BreslawScripts/yourCV.git
    cd yourCV
    
  5. Save it with the .adoc file extension in the directory that you created:
    yourCV.adoc
    
  6. Create a CSS stylesheet.
    If you have cloned the GitHub repository in the previous step, you can use the yourCV.css file that is included. Alternatively, you can download it here or create your own.
  7. Convert the Asciidoc file into HTML with your customised stylesheet:
    asciidoctor -a nofooter -a stylesheet=yourCV.css yourCV.adoc
    
  8. Create a PDF from the HTML file.
    This is straightforward with wkhtmltopdf, which will preserve and convert the inline styling in the HTML:
    wkhtmltopdf yourCV.html yourCV.pdf
    
  9. Generate a style template as an ODT file:
    pandoc -o refCV.odt yourCV.html
    
    Or as a DOCX file:
    pandoc -o refCV.docx yourCV.html
    
    Alternatively, use the sample files provided: refCV.docx or refCV.odt.
    Make any changes you wish the styles in LibreOffice or Word, e.g. to "Heading 1", "Heading 2", etc.
  10. Generate your CV as an ODT file:
    pandoc -o yourCV.odt --reference-odt=refCV.odt yourCV.html
    
    Or as a DOCX file:
    pandoc -o yourCV.odt --reference-odt=refCV.odt yourCV.html
    

Automate your CV generation tasks with a Rakefile

See the following blog post on how to automate the file conversions:
Automate shell commands with a simple Rakefile