Skip to content

Instantly share code, notes, and snippets.

@capsulecorplab
Last active March 1, 2020 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save capsulecorplab/8a160faed0006c0766eca2701b0cf0e9 to your computer and use it in GitHub Desktop.
Save capsulecorplab/8a160faed0006c0766eca2701b0cf0e9 to your computer and use it in GitHub Desktop.
bash script for converting multiple (GitHub flavored) markdown to asciidoc files
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem "kramdown-asciidoc", "~> 1.0"
GEM
remote: https://rubygems.org/
specs:
kramdown (1.17.0)
kramdown-asciidoc (1.0.1)
kramdown (~> 1.17.0)
PLATFORMS
ruby
DEPENDENCIES
kramdown-asciidoc (~> 1.0)
BUNDLED WITH
2.1.4
#!/usr/bin/env bash
###############################################################################
# bash script for converting multiple (GH-flavored) markdown to asciidoc files.
# Inspired by
# https://matthewsetter.com/convert-markdown-to-asciidoc-with-kramdown-asciidoc
#
# Requirements:
# * Ruby 2.4+ (2.4.5 recommended)
# * bundler 2.1.4
#
# Usage:
# $ ./md_to_adoc.sh
###############################################################################
if ! command -v gem 1>/dev/null 2>&1; then
echo "Ruby not installed! To install ruby using rbenv, please refer to https://gist.github.com/aa4c5a8167509b94ac43405f99bc9ffd"
elif ! command -v bundler 1>/dev/null 2>&1; then
echo "bundler not installed!, please run:
gem install bundler:2.1.4"
elif ! command -v kramdoc 1>/dev/null 2>&1; then
echo "kramdoc not installed!, please run:
bundle install"
fi
find . -name "*.md" -type f -exec sh -c 'kramdoc --format=GFM --wrap=ventilate {}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment