quick-guides

Converting AsciiDoc to Markdown

Hey, passing quickly to drop this useful tip.

I just found this comfortable way of converting and working with Markdown files, and thought of sharing these two tips.

Converting from AsciiDoc to Markdown

The installation line below focus on osx users, but pandoc and asciidoc are also available for linux and windows.

  1. Install asciidoc and pandoc:
$ brew install asciidoc pandoc

2. Using asciidoc, generate an xml from your adoc file:

$ asciidoc -b docbook yourfile.adoc

On the directory now you have yourfile.adoc and yourfile.xml.

3. Using these files, generate the markdown file:

○ → pandoc -f docbook -t markdown_strict yourfile.xml yourfile.adoc -o yourfile.xml

If you are getting line breaks after each 80 chars on the generated md file, then, use this command instead. It worked well for me:

iconv -t utf-8 yourfile.xml | pandoc -f docbook -t markdown_strict --wrap=none | iconv -f utf-8 > yourfile.md

Congrats your doc is now in markdown style. Let’s validate the work.

Editing Markdown

A recent tool I started using and I enjoy a lot, is Typora. I’m using it for editing lots of Markdown files (i.e. GitHub readme files). It’s available for OS X, Linux and Windows. The editor is easy to use and enables writing in markdown super quick without having to memorize all the sintax.

Notice how editor feels natural when you can directly edit the resulting layout (with GitHub flavors).

Finally… Once you migrated your adoc file, just open the folder using Typora to double check the work and adjust details.


Credits to: https://tinyapps.org/blog/201701240700_convert_asciidoc_to_markdown.html

One thought on “Converting AsciiDoc to Markdown

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s