You can easily convert Markdown→HTML just by executing this script.
Preparation:
gem install redcarpet
Just put HTML in @md and execute the script.
When you run this,
@md='
# Limited Time Only!
'
# gem install redcarpet
require 'redcarpet'
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
@html = markdown.render(@md)
File.open('C:\pg\md_to_html\md_to_html.rb', 'a') do |file|; file.puts @html ; end
__END__
__END__
This becomes
@md='
# Limited Time Only!
'
# gem install redcarpet
require 'redcarpet'
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
@html = markdown.render(@md)
File.open('C:\pg\md_to_html\md_to_html.rb', 'a') do |file|; file.puts @html ; end
__END__
__END__
# Limited Time Only!
like this.
By using Atom’s Script package, you can execute it with a keyboard shortcut, which is convenient.
The reason for outputting to the same file is that it’s tedious to output to an external text file and then open it. In large systems, doing this sort of thing is taboo, let alone mixing text into a .rb file. But for personal use, since this is more convenient, I think this approach is acceptable.
I think various converters can be made in the same way. Like json > xml. Though probably not very useful. Please try it.