Transform other markup languages into asciidoc using pandoc

Oct 6, 2020 · 1 min read

In all use cases I used pandoc. Together with bash or powershell CLI is possible to convert multiple files.

Good examples of comparison of lightweight markup languages:
(https://en.wikipedia.org/wiki/Lightweight_markup_language) and link

Here’s the Pandoc command to convert from the command line

If you would like to convert simple markdown file into org-mode file you can use pandoc.

pandoc -f markdown -t org -o newfile.org original-file.markdown

Pandoc can convert between multiple document formats

To convert a bunch of Markdown files to org-mode:

  for f in `ls *.md`; do
    pandoc -f markdown -t org -o ${f}.org ${f};
  done

Migrate from org file (without emacs)

Export fmr .org to asciidoc or markdown (little step back)

  iconv -t utf-8 .\file-it-other-encoding.org | pandoc -f org -t asciidoc | iconv -f utf-8 > .\file-in-utf8.org 

Export org (orgmode) to html from vscode

  pandoc atelier.org -o atelier.html

Convert multiple files

Using recursive version of ls command.

for f in `ls -R *.org | awk '/:$/&&f{s=$0;f=0}/:$/&&!f{sub(/:$/,"");s=$0;f=1;next}NF&&f{ print s"/"$0 }'`; do pandoc -f org -t asciidoc -o ${f}.adoc ${f}; done

Sources