{"id":27624215,"url":"https://github.com/lordsynergy/editor_rails","last_synced_at":"2025-04-23T11:22:53.122Z","repository":{"id":289297084,"uuid":"970787049","full_name":"lordsynergy/editor_rails","owner":"lordsynergy","description":"Editor.js rendering and validation engine for Ruby and Rails","archived":false,"fork":false,"pushed_at":"2025-04-22T15:44:00.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T15:45:09.745Z","etag":null,"topics":["content","editorjs","json","rails","renderer","ruby","wysiwyg"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/editor_rails","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/lordsynergy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2025-04-22T14:34:41.000Z","updated_at":"2025-04-22T15:02:21.000Z","dependencies_parsed_at":"2025-04-22T15:55:41.264Z","dependency_job_id":null,"html_url":"https://github.com/lordsynergy/editor_rails","commit_stats":null,"previous_names":["lordsynergy/editor_rails"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordsynergy%2Feditor_rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordsynergy%2Feditor_rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordsynergy%2Feditor_rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordsynergy%2Feditor_rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lordsynergy","download_url":"https://codeload.github.com/lordsynergy/editor_rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250422588,"owners_count":21427976,"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":["content","editorjs","json","rails","renderer","ruby","wysiwyg"],"created_at":"2025-04-23T11:22:52.305Z","updated_at":"2025-04-23T11:22:53.116Z","avatar_url":"https://github.com/lordsynergy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EditorRails\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.txt)\n\nEditorRails is a Ruby gem that brings [Editor.js](https://editorjs.io/) support to Rails applications.  \nIt allows rendering JSON data generated by Editor.js into safe HTML and plain text.\n\n---\n\n## Features\n\n- Support for structured content (Editor.js blocks)\n- Built-in validation using JSON Schema\n- Secure HTML output via escaping\n- Configurable block rendering system\n- No JavaScript dependencies required on the server side\n\n---\n\n## Installation\n\nAdd this line to your Gemfile:\n\n```ruby\ngem \"editor_rails\"\n```\n\nAnd then execute:\n\n```bash\nbundle install\n```\n\n---\n\n## Usage\n\n```\ndata = {\n  \"time\" =\u003e \"123456789\",\n  \"blocks\" =\u003e [\n    { \"type\" =\u003e \"paragraph\", \"data\" =\u003e { \"text\" =\u003e \"Hello \u003cb\u003eworld\u003c/b\u003e\" } }\n  ]\n}\n```\n\n```bash\ndocument = EditorRails::Document.new(data)\ndocument.render(format: :html)\n# =\u003e \"\u003cp\u003eHello \u0026lt;b\u0026gt;world\u0026lt;/b\u0026gt;\u003c/p\u003e\"\n\ndocument.render(format: :plain)\n# =\u003e \"Hello \u003cb\u003eworld\u003c/b\u003e\"\n```\n\n---\n\n## Configuration\n\nThe gem includes a default schema for the `paragraph` block, located at:\n\n```\nlib/editor_rails/schemas/\n```\n\nYou can configure enabled block types and schema path:\n\n```ruby\nEditorRails.configure do |config|\n  config.enabled_blocks = %w[paragraph]\n  config.schemas_path = Rails.root.join(\"config/editor_schemas\").to_s\nend\n```\n\nSchemas should follow the JSON Schema format and be stored in YAML files.\nEach block must have a schema named like paragraph.yml, header.yml, etc.\n\n---\n\n## Development\n\nTo run tests and linters:\n\n```bash\nbundle exec rake\n```\n\n#### Rendering Custom Blocks\n\nTo support a new block:\n\n1. Create a class in EditorRails::Blocks namespace (e.g., Header)\n2. Inherit from EditorRails::Blocks::Base\n3. Implement render and plain\n4. Add a corresponding schema\n\n```ruby\nmodule EditorRails\n  module Blocks\n    class Header \u003c Base\n      def render\n        \"\u003ch1\u003e#{ERB::Util.html_escape(data[\"text\"])}\u003c/h1\u003e\"\n      end\n\n      def plain\n        data[\"text\"].to_s\n      end\n    end\n  end\nend\n```\n\n---\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/lordsynergy/editor_rails.\n\n---\n\n## License\n\nThis gem is licensed under the [MIT License](https://opensource.org/license/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordsynergy%2Feditor_rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flordsynergy%2Feditor_rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordsynergy%2Feditor_rails/lists"}