{"id":13878321,"url":"https://github.com/alexandreruban/action-markdown","last_synced_at":"2025-04-06T07:13:32.822Z","repository":{"id":63849038,"uuid":"564398630","full_name":"alexandreruban/action-markdown","owner":"alexandreruban","description":"Markdown content editing for Ruby on Rails.","archived":false,"fork":false,"pushed_at":"2024-06-28T22:28:35.000Z","size":78,"stargazers_count":147,"open_issues_count":9,"forks_count":7,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-30T05:09:37.177Z","etag":null,"topics":["markdown-editor","ruby","ruby-on-rails"],"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/alexandreruban.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"MIT-LICENSE","code_of_conduct":null,"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":["alexandreruban"]}},"created_at":"2022-11-10T16:24:17.000Z","updated_at":"2025-03-12T06:09:04.000Z","dependencies_parsed_at":"2024-10-29T19:26:16.697Z","dependency_job_id":null,"html_url":"https://github.com/alexandreruban/action-markdown","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"d12722da01d0d2b254e132b4c21fb090a6af31d5"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandreruban%2Faction-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandreruban%2Faction-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandreruban%2Faction-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandreruban%2Faction-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexandreruban","download_url":"https://codeload.github.com/alexandreruban/action-markdown/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445671,"owners_count":20939958,"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":["markdown-editor","ruby","ruby-on-rails"],"created_at":"2024-08-06T08:01:46.293Z","updated_at":"2025-04-06T07:13:32.808Z","avatar_url":"https://github.com/alexandreruban.png","language":"Ruby","funding_links":["https://github.com/sponsors/alexandreruban"],"categories":["Ruby"],"sub_categories":[],"readme":"# Welcome to ActionMarkdown\n\nDo you like GitHub issues Markdown editor? I love it too! ActionMarkdown aims to provide the same feature out of the box for Rails applications. With ActionMarkdown, it is easy to write some Markdown text in a form field and convert it to HTML seamlessly in the view.\n\n## Installation\n\nLet's add this line to our application's `Gemfile`:\n\n```ruby\ngem \"action_markdown\"\n```\n\nWe can then run the installation script to copy the migration file:\n\n```bash\nbin/rails action_markdown:install\n```\n\nLast but not least, we need to run the migration:\n\n```bash\nbin/rails db:migrate\n```\n\nActionMarkdown is now installed, we are good to go!\n\n## Usage\n\nLet's imagine we want to write articles in the Markdown format. In our Rails application, we will have an `Article`. To add Markdown content, we need to use the `has_markdown` macro like this:\n\n```rb\nclass Article \u003c ApplicationRecord\n  has_markdown :content\n\n  validates :content, presence: true\nend\n```\n\nWithout adding any new migration, we can now create a new article with Markdown text:\n\n```rb\nmarkdown = \u003c\u003c~MARKDOWN\n# Title\n\nThis is a paragraph.\nMARKDOWN\n\narticle = Article.create! content: markdown\n```\n\nIn the view, the Markdown content will be converted to HTML. For example, in the `ArticlesController#show` view, we can render the content converted to HTML like this:\n\n```erb\n\u003c%# articles/show.html.erb %\u003e\n\n\u003c%= @article.content %\u003e\n```\n\nIn the view above, the Markdown content will automatically be converted to the following HTML:\n\n```html\n\u003ch1\u003eTitle\u003c/h1\u003e\n\u003cp\u003eThis is a paragraph.\u003c/p\u003e\n```\n\n**Note**: To use a Markdown fields in forms, we should use the `markdown_field` helper like in the following example:\n\n```erb\n\u003c%= form_with model: article do |f| %\u003e\n  \u003c%= f.label :content %\u003e\n  \u003c%= f.markdown_field :content %\u003e\n\n  \u003c%= f.submit \"Save\" %\u003e\n\u003c% end %\u003e\n```\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandreruban%2Faction-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandreruban%2Faction-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandreruban%2Faction-markdown/lists"}