Skip to content

Instantly share code, notes, and snippets.

@AquisTech
Forked from cheungnj/script.sh
Last active March 1, 2023 01:53
Show Gist options
  • Save AquisTech/2d951f6a4983e917b4d2176a4ce0075d to your computer and use it in GitHub Desktop.
Save AquisTech/2d951f6a4983e917b4d2176a4ce0075d to your computer and use it in GitHub Desktop.
Convert asciidoc to Github Flavored Markdown
# Adapted from https://tinyapps.org/blog/nix/201701240700_convert_asciidoc_to_markdown.html
# Using asciidoctor 1.5.6.1 and pandoc 2.0.0.1
# Install pandoc and asciidoctor
sudo apt install asciidoctor
sudo wget https://github.com/jgm/pandoc/releases/download/2.0.0.1/pandoc-2.0.0.1-1-amd64.deb
sudo dpkg -i pandoc-2.0.0.1-1-amd64.deb
# Convert asciidoc to docbook using asciidoctor
asciidoctor -b docbook foo.adoc
# foo.xml will be output into the same directory as foo.adoc
# Convert docbook to markdown
pandoc -f docbook -t gfm foo.xml -o foo.md --columns=120
# Unicode symbols were mangled in foo.md. Quick workaround:
iconv -t utf-8 foo.xml | pandoc -f docbook -t gfm | iconv -f utf-8 > foo.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment