Original File

The base file written in markdown is sample.md.

Text file

The markdown file converted to plaintext used the command

pandoc -f markdown -t plain sample.md -s -o sample.txt

Resulted in the file sample.txt

Man Docs

The markdown file was converted to a *.man file, then to a file readable on a terminal using the commands.

pandoc -f markdown -t man sample.md -s -o sample.man

groff -mandoc -Thtml sample.man > sample-man.html

Which resulted in the man file sample.man which was processed with groff to produce the file sample-man.html.

If you have a linux system you can type the command

man groff

to see the man page for groff. Or the command

zless /usr/share/man/man1/groff.1.gz

to see the source file. This is typically how documentation is stored on unix or linux systems.

RTF

A document format used by Microsoft and some other system is RTF (Rich Text Format). I am not going to show you the raw RTF file since is is binary. But it was produced and viewable with the following commands.

pandoc -f markdown -t rtf sample.md -s -o sample.rtf

wordpad sample.rtf screen capture to sample-rtf.png

You can see a screen shot of what is looks like in the wordpad program wordpad sample.rtf

Docx

One format that is available from pandoc is used by Microsoft work is the docx format. I was able to produce and view it with the following commands

pandoc -f markdown -t docx sample.md -s -o sample.docx

Open in Libreoffice sample.docx export as PDF

The results can be exported by Libreoffice in pdf format that looks like sample.docx in PDF

TeX / LaTeX

The pandoc program converted the sample.md program to a *.tex file with the commands

pandoc -f markdown -t latex sample.md -s -o sample.tex

pdflatex sample.tex ; mv sample.pdf sample-tex.pdf

The LaTeX format document looks like sample.tex and after processing pdflatex sample.tex

Or the file can be directly converted to a PDF file using pandoc

pandoc -f markdown -t latex sample.md -s -o sample-md-latex.pdf

Which produced the file pandoc to latex to pdf

pandoc -f markdown -t html5 sample.md -s -o sample-md-html5.pdf

Which produced the file pandoc to html5 to pdf

HTML

One of the most common uses by me for pandoc is to convert markdown to html5 format. Now a simple conversion can be accmplished with

pandoc -f markdown -t html5 sample.md -s -o sample.html

Which produces a page as seen in a text editor as sample.html source code or in standard browser view as sample.html

You can see a simple html version of this sample page you could write directly at manual sample.html which produces a page like basic sample.html.

XML / Docbook

The XML format is used in Open Office and Microsoft Word for their DocX format. There is similiar type of XML document called Docbook which I have written in the past directly. Lets look at some conversion methods and the output files.

pandoc -f markdown -t opendocument sample.md -s -o sample-md.xml

Converts to XML as used in open office. The result looks like: Openoffice XML

pandoc -f markdown -t docbook5 sample.md -s -o sample-md.doc5

xsltproc -o $OUTPUT $OPTIONS $CSSSTYLE $HTMLSTYLE $SOURCE

where $OPTIONS=“–stringparam section.autolabel 1 –stringparam toc.section.depth 4” and $CSSSTYLE=“–stringparam html.stylesheet style-ob.css” and $HTMLSTYLE=/usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl"


Written by John F. Moore

Last Revised: Tue 19 Apr 2022 09:45:47 PM EDT

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
HTML5 Powered with CSS3 / Styling, and
      Semantics