{"id":13877881,"url":"https://github.com/hardpixel/mrml-ruby","last_synced_at":"2025-04-04T19:10:04.636Z","repository":{"id":56884686,"uuid":"334936923","full_name":"hardpixel/mrml-ruby","owner":"hardpixel","description":"Ruby wrapper for MRML, the MJML parser implementation in Rust.","archived":false,"fork":false,"pushed_at":"2025-01-15T19:53:39.000Z","size":115,"stargazers_count":54,"open_issues_count":2,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T18:13:27.456Z","etag":null,"topics":["mjml","native-extension","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hardpixel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["jonian"]}},"created_at":"2021-02-01T12:06:38.000Z","updated_at":"2025-03-01T19:52:50.000Z","dependencies_parsed_at":"2023-12-01T08:25:50.955Z","dependency_job_id":"1ddd0b6c-80eb-41b3-a434-2b01cb33fb2d","html_url":"https://github.com/hardpixel/mrml-ruby","commit_stats":{"total_commits":67,"total_committers":1,"mean_commits":67.0,"dds":0.0,"last_synced_commit":"93e1e338567324cbc64f9da5d5b4078d27397a0c"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fmrml-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fmrml-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fmrml-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fmrml-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hardpixel","download_url":"https://codeload.github.com/hardpixel/mrml-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mjml","native-extension","ruby","ruby-gem"],"created_at":"2024-08-06T08:01:33.888Z","updated_at":"2025-04-04T19:10:04.604Z","avatar_url":"https://github.com/hardpixel.png","language":"Ruby","readme":"# MRML Ruby\n\nRuby wrapper for [MRML](https://github.com/jdrouet/mrml), the [MJML](https://mjml.io) markup language implementation in Rust. Rust must be available on your system to install this gem if you use a version below [v1.4.2](https://github.com/hardpixel/mrml-ruby/releases/tag/v1.4.2).\n\n[![Gem Version](https://badge.fury.io/rb/mrml.svg)](https://badge.fury.io/rb/mrml)\n[![Build](https://github.com/hardpixel/mrml-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/hardpixel/mrml-ruby/actions/workflows/build.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/7e307214d3c2e4d2056d/maintainability)](https://codeclimate.com/github/hardpixel/mrml-ruby/maintainability)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'mrml'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install mrml\n\n## Usage\n\n```ruby\nrequire 'mrml'\n\nmjml = \u003c\u003c-HTML\n\u003cmjml\u003e\n  \u003cmj-head\u003e\n    \u003cmj-title\u003eNewsletter Title\u003c/mj-title\u003e\n    \u003cmj-preview\u003eNewsletter Preview\u003c/mj-preview\u003e\n  \u003c/mj-head\u003e\n  \u003cmj-body\u003e\n    \u003cmj-section\u003e\n      \u003cmj-column\u003e\n        \u003cmj-text font-size=\"20px\" color=\"#F45E43\" font-family=\"helvetica\"\u003eHello World\u003c/mj-text\u003e\n      \u003c/mj-column\u003e\n    \u003c/mj-section\u003e\n  \u003c/mj-body\u003e\n\u003c/mjml\u003e\nHTML\n\n# Using module methods\nMRML.to_html(mjml) # Generate html from mjml\nMRML.to_json(mjml) # Generate json from mjml\nMRML.to_hash(mjml) # Generate hash from mjml\n\n# Using Template class\ntemplate = MRML::Template.new(mjml)\n\ntemplate.title   # Get template title\ntemplate.preview # Get template preview\n\ntemplate.to_html # Render as html\ntemplate.to_mjml # Render as mjml\ntemplate.to_json # Render as json\ntemplate.to_hash # Render as hash\n```\n\n```ruby\nrequire 'mrml'\n\njson = \u003c\u003c-JSON\n{\n  \"type\": \"mjml\",\n  \"children\": [{\n    \"type\": \"mj-head\",\n    \"children\": [{\n      \"type\": \"mj-title\",\n      \"children\": \"Newsletter Title\"\n    }, {\n      \"type\": \"mj-preview\",\n      \"children\": \"Newsletter Preview\"\n    }]\n  }, {\n    \"type\": \"mj-body\",\n    \"children\": [{\n      \"type\": \"mj-section\",\n      \"children\": [{\n        \"type\": \"mj-column\",\n        \"children\": [{\n          \"type\": \"mj-text\",\n          \"attributes\": {\n            \"font-size\": \"20px\",\n            \"color\": \"#F45E43\",\n            \"font-family\": \"helvetica\"\n          },\n          \"children\": [\"Hello World\"]\n        }]\n      }]\n    }]\n  }]\n}\nJSON\n\n# Create Template from JSON\ntemplate = MRML::Template.from_json(json)\n\ntemplate.to_html # Render as html\ntemplate.to_mjml # Render as mjml\ntemplate.to_json # Render as json\ntemplate.to_hash # Render as hash\n```\n\n## Benchmark\n\n```\nWarming up --------------------------------------\n                mrml     3.069k i/100ms\n                mjml     1.000  i/100ms\nCalculating -------------------------------------\n                mrml     32.537k (±16.1%) i/s -    156.519k in   5.029759s\n                mjml      1.895  (± 0.0%) i/s -     10.000  in   5.283579s\n\nComparison:\n                mrml:    32537.2 i/s\n                mjml:        1.9 i/s - 17169.16x  slower\n\nCalculating -------------------------------------\n                mrml     3.166k memsize (     0.000  retained)\n                         2.000  objects (     0.000  retained)\n                         1.000  strings (     0.000  retained)\n                mjml    21.253k memsize (     1.490k retained)\n                       107.000  objects (    15.000  retained)\n                        20.000  strings (    11.000  retained)\n\nComparison:\n                mrml:       3166 allocated\n                mjml:      21253 allocated - 6.71x more\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/hardpixel/mrml-ruby.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":["https://github.com/sponsors/jonian"],"categories":["Tools","Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardpixel%2Fmrml-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhardpixel%2Fmrml-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardpixel%2Fmrml-ruby/lists"}