advanced.md 11 KB


toc-title: Contents lang: en title: Pandoc Markdown subtitle: A VSCode extension for wrinting Pandoc Markdown documents using Pandoc author: Dr Taz keywords: Markdown, Pandoc, VSCode bibliography: "assets/MyLib.bib" csl: "assets/journal-of-neurophysiology.csl" fontsize: 11.5pt

mainfont: Palatino, Georgia, Times, Arial

Abstract

Pandoc Markdown allows writing Markdown documents using Pandoc for both typesetting and real-time preview, with no third party renderers nor CSS files, just Pandoc. As a bonus, a curated Article CSS is provided, which allows producing documents inspired by those produced by the article LaTeX class. This extension requires Pandoc to be available from the command line.

1. Intro

Please see Pandoc's Markdown for detailed documentation about basic and extended Pandoc Markdown.

2 Pandoc Markdown

2.1 Code

Pre formatted:

Normal text
Pre formatted

Source code:

# Python
import numpy as np
x = np.linspace(0,np.pi)
print("Hi from Python")

And:

// javascript
const changeColor = (newColor) => {
    const element = document.getElementById('message');
    element.style.color = newColor;
}

2.2 Columns

Columns are specified as a <div> of class .columns, which contains another <divs> of <.column> class. <divs> are specified in Pandoc Markdown using at least three colons as ::: . For example:

:::{[#label] .columns [attrs]}

:::{.column width="45%"}
First column contents
:::

:::{.column width="10%"}
:::

:::{.column width="45%"}
Second Column contents
:::

:::

Which produces something as:

:::{.columns}

:::{.column width="48%;font-style: italic"} 1st Column Lorem ipsum dolor sit amet, consectetur adipiscing elit :::

:::{.column width="4%"} :::

:::{.column width="48%;background-color:#eee"} 2nd Column, Lorem ipsum dolor sit amet, consectetur adipiscing elit :::

:::

2.3 Tables

i. Simple

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua (see Table 1).

incididunt ut labore et dolore magna aliqua (see [Table 1](#Table1)).

: Tabla 1: Tabla simple []{#Table1}

| Syntax    | Description |
| --------- | ----------- |
| Header    | Title       |
| Paragraph | Text        |

Which renders as:

: Tabla 1: Tabla simple []{#Table1}

Syntax Description
Header Title
Paragraph Text

ii. Aligned

Column alignments are determined by the position of the header text relative to the dashed line below it

: Table 1.1:  Simple table syntax.

Right     Left     Center     Default
-------     ------ ----------   -------
12          12      12          12
123         123     123         123
1           1       1           1

: Table 1.1: Simple table syntax.

Right Left Center Default


12 12 12 12 123 123 123 123 1 1 1 1

Tables using pipes:

: Table 2: Using pipes and colons

| Left      | Centered | Right       |
|:--------- |:--------:| -----------:|
| Header    | Title    | Here's this |
| Paragraph | Text     | And more    |

Which renders as:

: Table 2: Using pipes and colons

Left Centered Right
Header Title Here's this
Paragraph Text And more

Or simply:

: Tabla 2.1: Pipe, simple

Fruit  | Price ($)  | Existence
-------|-----------:| :-------:
apple  | 2.05       | 3 box
pear   | 1.37       | 2 kg

: Tabla 2.1: Pipe, simple

Fruit Price ($) Existence
apple 2.05 3 box
pear 1.37 2 kg

2.4 Small caps

To write small caps, use the smallcaps class:

This is a  [Small caps text]{.smallcaps} , got it?

This is a [Small caps text]{.smallcaps} , got it?

2.5 Figuras

i. Simple

See [Fig. 1](#fig1)

See Fig. 1

![Figure 1: A math plot](assets/plot-3d-small.png){#fig1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

{#fig1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

ii. With attributes

See Fig. 2.

![Fig. 2: Image (scaled to width=40% column)](assets/plot-3d-small.png){#figattrs width=40%}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua (see Fig Attrs).

{#figattrs width=40%}

2.6 Aside figures and text

<aside>

![Fig. 3: Aside figure](assets/plot-small.png)

</aside>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis cursus in hac habitasse platea dictumst quisque sagittis. In ornare quam viverra orci. Mauris rhoncus aenean vel elit. Fames ac turpis egestas maecenas pharetra convallis. Mauris nunc congue nisi vitae suscipit tellus mauris a diam.

<aside>
This text should be located as an `<aside>` insert (right side).
</aside>