Skip to content

Instantly share code, notes, and snippets.

@hyuki
Last active March 10, 2020 00:20
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 hyuki/50eaa7b1ce69ef3821ab12b6a03a56a5 to your computer and use it in GitHub Desktop.
Save hyuki/50eaa7b1ce69ef3821ab12b6a03a56a5 to your computer and use it in GitHub Desktop.
url-markdown.rb - URL to Markdown
#! /usr/bin/env ruby
require 'mechanize'
if ARGV.length != 1
abort("Usage: url-markdown URL")
end
url = ARGV[0]
if !url.match(/^http/)
url = "https://" + url
end
agent = Mechanize.new
page = agent.get(url)
puts "- [#{page.title}](#{url})"
# vim: set filetype=ruby:
@hyuki
Copy link
Author

hyuki commented Mar 9, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment