Instruction Manual

August 8, 2022 (05:48:29 PM)

Speed-Run

To compile those notes, you need

Then, clone the repository at https://rocketgit.com/user/caubert/CSCI_3410, and refer to the example file for a gentle test and guide on the syntax and tool of this document. Change the current folder to notes, and execute make example. You can have a look at notes/Makefile to understand what is happening in the example rule.

Overview

The Generating Documents (Basic) Using Markdown User Manual outlines the objectives, requirements, and needs to be addressed when training users on how to generate a PDF, HTML, or ODT document using markdown file. The plan presents the activities needed to support file development.

Introduction

Markdown is a fast and easy way to take notes, create content for a website, and produce print-ready documents. It’s a lightweight markup language with plain text formatting syntax. Markdown is designed to be converted to many different output formats such as PDF, Word, ODT, HTML, and many more. It is both portable and platform independent, more intuitive to read and write, and can be used for websites, documents, notes, books, etc., but is often used to format readme files and in online discussion forums.

How Does Markdown Work?

Markdown text is written and stored in plaintext file with a markdown extension (e.g. .md). Using a separate markdown application capable of processing markdown (we will be using Pandoc), it takes the markdown formatted text and converts it to HTML. The HTML file can then be viewable in a web browser or then converted to another file format, like PDF.

Figure 1.1: Markdown text file is converted and displayed in a web browser

Requirements

Skills required

Helpful Skills:

Software Requirements

For a fully functioning environment and step by step guide on installation instructions follow the instructions below:

NOTE: All the following steps must be installed on a Linux operating system.

  1. Install Git In your terminal, type (as root): apt update then type: apt install git

NOTE: Upon opening your terminal, you may see username@hostname:~$. You want your terminal to run as root@hostname. To do this, upon opening your terminal, type: su --

Then enter your password. You should see something like this:

Terminal Root User

  1. Install Make In your terminal, type (as root): apt-get update then type: apt-get install build-essential

  2. Install LaTex

  1. Install Python 3 In your terminal type (as root): apt-get install python3-pip

  2. Install Pandoc

  1. Install pandoc-include-code filter

NOTE: To run terminal as a normal user, type: su - username where “username” is your username. You should see something like this:

Terminal Normal User

  1. Install pandoc-numbering filter Type (as normal user): pip3 install pandoc-numbering

  2. Install latexmk fully automated latex document generation

NOTE: You may need to expose hidden files while in “Home”. To do this press Ctrl + H.

  1. Install pdf2svg In your terminal type (as root): apt-get install pdf2svg

  2. Install librsvg2-bin In your terminal type (as root): apt-get install librsvg2-bin

  3. Install texlive-xetex In your terminal type (as root): apt-get install texlive-xetex

  4. Install linuxlibertine font and freefont

  1. Clone this basic folder structure (as a normal user) Type: git clone https://github.com/poonamveeral/GeneralRepo

  2. Testing Pandoc

<p>I’m a test for pandoc.</p>
  1. Testing pandoc-numbering

pandoc test_pandoc-numbering.md --filter pandoc-numbering -o test_pandoc-numbering.html

<p><span id="exercise:1" class="pandoc-numbering-text exercise"><strong>Exercise 1</strong> <em>(The first exercise)</em></span></p>
<p><span id="exercise:2" class="pandoc-numbering-text exercise"><strong>Exercise 2</strong> <em>(The second exercise)</em></span></p>
  1. Test pandoc-citeproc

pandoc --citeproc test_pandoc-citeproc.md -o test_pandoc-citeproc.html

<p><span class="citation" data-cites="item1">(Doe 2005)</span></p>
<h1 class="unnumbered" id="references" class="unnumbered">References</h1>
<div id="refs" class="references hanging-indent" role="doc-bibliography">
<div id="ref-item1" role="doc-biblioentry">
<p>Doe, John. 2005. <em>First Book</em>.</p>
</div>
</div>
  1. Test pandoc-include-code

pandoc -F pandoc-include-code test_pandoc-include-code.md -o test_pandoc-include-code.html

<p>Here is some code:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode md"><code class="sourceCode markdown"><span id="cb1-1"><a href="#cb1-1"></a>I&#39;m a test for pandoc. </span></code></pre></div>

If you’re receiving “Could not find executable pandoc-include-code”

export PATH=$PATH:/home/username/.cabal/bin

Creating the Document

Follow these steps to learn how to create a simple markdown document utilizing bibliographies, images/figures, and code blocks.

Step 1

To start off, you’re going to need a folder structure set up like this:

Folder Structure

If you completed number 13 from 2.2 Software Requirements skip step 2. If not, continue on.

Step 2

You want each folder to contain:

.
├── install/                -- How to install requirements to compile the document.
│   └── .md files           -- To test Pandoc
├── bib/            -- References (including reference to the document). 
│   └── .bib files          -- To store citations.
├── code/           -- Source code included in the document.
│   └── code files          -- (E.g. .java, .xml, .sql)
├── fig/            -- Source code for various figures used in the document.
├── img/                -- Various image files itegrated in the document.
├── latex/          -- Latex configuration file.
├── style/                  -- CSS style used for the web page.
├── Makefile                -- Directives to generate example.md document.
├── README.md               -- The present file.
└── example.md              -- Sample file to test.

An example of a basic template of a markdown file can be found at “example.md” in the generic repo from step 13 from above.

Compiling and Converting the Document

Follow these steps to learn how to compile and convert a markdown file to PDF, ODT, and HTML. Other possible conversion formats can be found here: https://pandoc.org/

pandoc <filters> inputfile.md -o outputfile.ext

or

pandoc <filters> -o outputfile.ext inputfile.md

PDF

For our example, in your terminal, while in the directory of where your markdown file is located, which should be your “Course” folder, type:

make pdf

or

pandoc --toc --filter pandoc-numbering --citeproc --filter pandoc-include-code \
--top-level-division=chapter -M date="$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" \
--pdf-engine=xelatex --pdf-engine-opt=-shell-escape -V links-as-notes \
--default-image-extension=pdf -o example.pdf example.md

To check if the results worked, from your desktop, navigate to your “Course” folder. You should see a new file called “example.pdf”.

ODT

For our example, in your terminal, while in the directory of where your markdown file is located, which should be your “Course” folder, type:

make odt

or

pandoc  --toc --filter pandoc-numbering --citeproc --filter pandoc-include-code \
--top-level-division=chapter -M date="$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" \
--default-image-extension=svg -o example.odt example.md

To check if the results worked, from your desktop, navigate to your “Course” folder. You should see a new file called “example.odt”.

HTML

For our example, in your terminal, while in the directory of where your markdown file is located, which should be your “Course” folder, type:

make html

or

pandoc --toc --filter pandoc-numbering --citeproc --filter pandoc-include-code \
--top-level-division=chapter -M date="$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" \
--css=style/style.css --toc-depth=1 --self-contained --default-image-extension=svg \
-o example.html example.md

where “style.css” is the name of your css file.

To check if the results worked, from your desktop, navigate to your “Course” folder. You should see a new file called “example.html”.