Markdown Link Extractor API - Ruby Gem
Markdown Link Extractor parses markdown documents and extracts all links including inline, reference, autolinks, and image URLs.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_markdownlinkextractor'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_markdownlinkextractor
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_markdownlinkextractor'
# Initialize the client
client = APIVerve::Markdownlinkextractor::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ markdown: "# Sample Document
Check out [this link](https://example.com) and [another one](https://test.com).

Visit <https://autolink.com> or just https://bare-url.com
[Reference link][ref1]
[ref1]: https://reference.com" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ markdown: "# Sample Document
Check out [this link](https://example.com) and [another one](https://test.com).

Visit <https://autolink.com> or just https://bare-url.com
[Reference link][ref1]
[ref1]: https://reference.com" })
puts response["data"]
rescue APIVerve::Markdownlinkextractor::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Markdownlinkextractor::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Markdownlinkextractor::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"totalLinks": 6,
"links": [
{
"text": "this link",
"url": "https://example.com",
"type": "inline"
},
{
"text": "another one",
"url": "https://test.com",
"type": "inline"
},
{
"text": "Image",
"url": "https://example.com/image.png",
"type": "inline"
},
{
"text": "Reference link",
"url": "https://reference.com",
"type": "reference",
"reference": "ref1"
},
{
"text": "https://autolink.com",
"url": "https://autolink.com",
"type": "autolink"
},
{
"text": "https://bare-url.com",
"url": "https://bare-url.com",
"type": "bare"
}
],
"categories": {
"internal": {
"count": 0,
"links": []
},
"external": {
"count": 6,
"links": [
{
"text": "this link",
"url": "https://example.com",
"type": "inline"
},
{
"text": "another one",
"url": "https://test.com",
"type": "inline"
},
{
"text": "Image",
"url": "https://example.com/image.png",
"type": "inline"
},
{
"text": "Reference link",
"url": "https://reference.com",
"type": "reference",
"reference": "ref1"
},
{
"text": "https://autolink.com",
"url": "https://autolink.com",
"type": "autolink"
},
{
"text": "https://bare-url.com",
"url": "https://bare-url.com",
"type": "bare"
}
]
},
"email": {
"count": 0,
"links": []
},
"other": {
"count": 0,
"links": []
}
},
"markdownLength": 253
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/markdownlinkextractor?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.