Markdown Table Generator API - Ruby Gem

Markdown Table Generator converts structured data into properly formatted markdown tables with customizable column alignment.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_markdowntable'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_markdowntable

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_markdowntable'

# Initialize the client
client = APIVerve::Markdowntable::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({
  headers: Name,Age,City,
  rows: John Doe,30,New York,Jane Smith,25,Los Angeles,Bob Johnson,35,Chicago,
  alignment: "left"
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ headers: Name,Age,City, rows: John Doe,30,New York,Jane Smith,25,Los Angeles,Bob Johnson,35,Chicago, alignment: "left" })
  puts response["data"]
rescue APIVerve::Markdowntable::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Markdowntable::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Markdowntable::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "markdown": "| Name | Age | City |\n| --- | --- | --- |\n| John Doe | 30 | New York |\n| Jane Smith | 25 | Los Angeles |\n| Bob Johnson | 35 | Chicago |",
    "columnCount": 3,
    "rowCount": 3,
    "cellCount": 12,
    "headers": [
      "Name",
      "Age",
      "City"
    ],
    "alignments": [
      "left",
      "left",
      "left"
    ]
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.