Skip to content

Commit 672255e

Browse files
committed
Add rake convert
Converts HTML text to kramdown in terminal
1 parent 9304230 commit 672255e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Diff for: Rakefile

+8
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,11 @@ task index: %w[init] do
8181
'algolia',
8282
'--config=_config.yml,_config.index.yml'
8383
end
84+
85+
desc 'Convert HTML text to kramdown in your terminal'
86+
task :convert do
87+
puts 'Paste HTML text followed by a new line and press Control-D.'.magenta
88+
result = `bin/kramdown --input=html --output=kramdown`
89+
puts 'Converted text:'.magenta
90+
puts result.bold
91+
end

Diff for: bin/kramdown

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'kramdown' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("kramdown", "kramdown")

0 commit comments

Comments
 (0)