07/07/2021
I have been making quite a bit of note-taking in Markdown (.md) format and converting them to pdf or HTML format.
Pandoc is a Linux command-line tool that converts from one file format to another. It is pretty powerful as it could handle numerous file formats.
Comprehensive example commands can be found on the Pandoc documentation itself. The basic commands are as follows.
// Convert markdown to html
pandoc -s example.md -o example.html
// Convert markdown to pdf (latex is supported)
pandoc -s example.md -o example.pdf
The format is pandoc -s INPUTFILE -o OUTPUT.format
, where -s stands for standalone (and itโs optional as far as I know) and -o stands for output. There is a ton of supported commands you can do. It is possible to refer Pandoc to a .yaml file for your command input pandoc -d example.yaml
where -d specifies the defaults files (command line inputs).
Text organized this way is known as markdown format, and they are saved in .md files.
# heading 1
## heading 2
- Point 1
- Point 2
It is also possible to tag pictures in markdown format, however i prefer to do it in html style where <img src="example.png" width=200px></img>
.
Pandoc conversion of Markdown to HTML accepts a sort of latex-style mathematical syntax. However when converting from Markdown to HTML, the command pandoc --webtex FILE.md -o OUTPUT.HTML
is needed. This tag runs MathJax javascript to render the latex formulas, converting from x^2 + y^2 = 1
to using the $$
as the delimiter. From the looks of it, there isnโt any way to inline the formula. The mathematical expression will immediately be centralized.
This is a centralized equation
$$ x^2 + y^2 $$
This is a Matrix
\begin{matrix}
1 & 2 & 3\\
a & b & c
\end{matrix}
This is fraction
$\frac{A}{B}$
$\frac{3x}{2}$
$\frac{1+\frac{a}{b}}{1+\frac{1}{1+\frac{1}{a}}}$
This is differentiation
$f''(x)$
$f'(x)$
$f^{(k)}(x)$
$\frac{\partial f}{\partial x}$
$\frac{\partial^2 f}{\partial x^2}$
$\frac{\partial^{k} f}{\partial x^k}$
This is integration
$$\int$$
$\int_{a}^b f(x)dx$
$$\iint$$
$$\int_{a}^b\int_{c}^d f(x,y)dxdy$$
This is summation
$\sum$
$$\sum_{i=1}^n$$
$$\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$$
This is fraction
This is differentiation
This is integration
This is summation