URL to Markdown API - Ruby Gem
URL to Markdown is a powerful tool for converting any webpage into clean, readable Markdown format. It preserves the document structure including headings, links, lists, and images.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_urltomarkdown'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_urltomarkdown
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_urltomarkdown'
# Initialize the client
client = APIVerve::Urltomarkdown::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
url: "https://example.com/blog/getting-started",
includeImages: true,
includeLinks: true
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ url: "https://example.com/blog/getting-started", includeImages: true, includeLinks: true })
puts response["data"]
rescue APIVerve::Urltomarkdown::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Urltomarkdown::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Urltomarkdown::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"url": "https://example.com/blog/getting-started",
"title": "Getting Started Guide",
"markdown": "# Getting Started Guide\n\nWelcome to our platform. This guide will help you get up and running quickly.\n\n## Prerequisites\n\nBefore you begin, make sure you have:\n\n- A registered account\n- API credentials\n- Node.js 18 or higher\n\n## Installation\n\nInstall the package using npm:\n\n```\nnpm install example-sdk\n```\n\n## Quick Start\n\nHere's a simple example to get you started:\n\n1. Import the SDK\n2. Initialize with your API key\n3. Make your first request\n\n## Next Steps\n\nCheck out our [documentation](https://example.com/docs) for more details.\n\n",
"wordCount": 87,
"imageCount": 1,
"linkCount": 1
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/urltomarkdown?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.