Markdown and Pandoc
Markdown
Markdown is a simplified language to format text. Some people find writing in HTML (to make a web page) to be too messy, because it is. Markdown is simpler, here’s an example.
# This is a first level header
This is normal text.
A blank line above starts a new paragraph. **Two asterisks are used to begin and end bold.** A single asterisk is *italic*.
[This is a link to google](https://google.com).
## This is a level 2 header
Full markdown also supports footnotes.
Once a document is written in Markdown it can be converted to almost any other document type like HTML (for the web), Word DOCX, even an EPUB electronic book.
You can write Markdown with any plain text editor like Windows Notepad or the free Notepad++. PSPad is another good free text editor. I don’t recommend a word processor to do this because it can be confusing for people to save the document as plain text. The free TED editor is also very small and for Windows cmd.exe window.
Pandoc document convertor
Pandoc is free software you can use to convert one document type to another. But it works best if your write your document in Markdown. https://pandoc.org
If you write your document in Markdown you can convert it to lots of other formats. With Pandoc you can even make an HTML file that has images embedded in it so the person can download the one HTML page and they don’t have to download any other images, the images are inside the HTML.
I’ve used Markdown and Pandoc to make EPUB files. I would extract the text from a PDF file, change it to Markdown manually, and use Pandoc to make the EPUB file.
There are several variations of Markdown out there. Reddit uses its own type, Discord uses it’s own but does not support Markdown tables, Github uses its own variant as well.
Convert Markdown to HTML
Here’s a batch file to convert a markdown file to HTML which embeds all images and makes a table of contents.
@echo off
rem This is a Windows batch file for a cmd.exe window.
rem Make EPUB with Pandoc and Markdown files.
rem How to use other Pandoc command line paramters:
rem --epub-cover-image=cover1.png
rem --number-sections
rem --template=f:\chuck\ebook\pandoc\templates\default.epub
rem --css=\pandocbooks\style02.css
rem Optional: a style02.css file. You can just make an empty file for this.
rem Below is our Markdown file used as input for Pandoc.
set infile=mymarkdown.md
rem Below is the output HTML file that will be written.
set outfile=mypage.html
rem Set the full path to the Pandoc executable.
set pandoc=f:\apps\ebook\pandoc-3.1.13\pandoc.exe
REM see if exe file exists.
if not exist %pandoc% (
echo ERROR: Cannot find pandoc
)
echo %0 Please wait...
%pandoc% --standalone --toc --number-sections --from=markdown_mmd+backtick_code_blocks+yaml_metadata_block+line_blocks+auto_identifiers+fancy_lists+startnum+link_attributes --to=html -o %outfile% %infile%
if /I "%errorlevel%" neq "0" (
echo ERROR from pandoc.
) else (
echo Done. See %outfile%.)
Convert Markdown to EPUB
@echo off
rem This is a Windows batch file for a cmd.exe window.
rem Make EPUB with Pandoc and Markdown files.
rem --epub-cover-image=cover1.png
rem --number-sections
rem --template=c:\app\ebook\pandoc2.7.2\templates\default.epub
set inputfile=input.md
set outfile=mybook-test.epub
set pandoc=c:\app\ebook\pandoc2.7.2\pandoc.exe
REM see if exe file exists.
if not exist %pandoc% (
echo ERROR: pandoc was not found.
)
%pandoc% --from=markdown_mmd+backtick_code_blocks+yaml_metadata_block+line_blocks+auto_identifiers+fancy_lists+startnum --to=epub -o %outfile% %inputfile%
if /I "%errorlevel%" neq "0" (
echo ERROR from pandoc.
) else (
echo Done. See %outfile%.)
Links
Dillinger allows you to practice markdown. It stores your files in your browser so you cannot find the files on another browser. It also gives you an example of Markdown and the HTML it is converted to side-by-side. https://dillinger.io
Commonmark is one Markdown standard. But not all sites support all features in it. https://commonmark.org/help/
Markdown tutorial. https://www.markdowntutorial.com/
Learn Markdown here as well. https://www.writethedocs.org/guide/writing/markdown/
Pandoc. Free! https://pandoc.org
Notepad++ text editor. Free! https://notepad-plus-plus.org/
Editors.
Stackedit. This is used on the Stackoverflow site. At the top of the window click “Start writing” to practice markdown. https://stackedit.io/
Markdown Editor. Browser based editor. https://markdowneditor.net/
Typeora. Cross-platform minimal markdown editor. https://typora.io/
Elementor. A fast and free online Markdown editor with a live preview. Write, edit, and view your Markdown code in real-time. Perfect for developers, writers, and students. https://elementor.com/tools/markdown/
Markdown.md. Free open source online markdown editor. https://pandao.github.io/editor.md/en.html
And a search for more!

