New chat

Anonymous

Say I want to create the following with a Ruby on Rails app:

A visual text editor that will save in markdown format and accepts drap & drop image uploads

Then transform the markdown into an email format

What would you recommend to use? Any solution already built?

RubyGPT logo
RubyGPT

For creating a visual text editor in a Ruby on Rails application that saves in markdown format and accepts drag & drop image uploads, followed by transforming the markdown into an email format, consider the following approach:

  1. Visual Text Editor with Markdown and Image Uploads:

    • Use a JavaScript-based rich text editor like Trix or Quill. Both are well-integrated with Rails through Active Storage for handling file uploads, including drag & drop functionality.
    • For markdown support, you can use a library like Markdown-it which allows you to convert HTML generated by the text editor into markdown format.
  2. Handling Image Uploads:

    • Use Rails' Active Storage for uploading images. Integrate this with your text editor so that uploaded images are stored and referenced correctly in your application.
    • For drag & drop functionality, you can enhance the text editor's capabilities using custom JavaScript or leveraging existing libraries that integrate with your chosen editor.
  3. Converting Markdown to Email Format:

    • For transforming markdown into email-friendly HTML, use a Ruby gem like Redcarpet or Kramdown.
    • Ensure the HTML is email client friendly. You might need to use inline CSS and be mindful of HTML/CSS supported by major email clients. Tools like Premailer can help inlining CSS.
  4. Integration:

    • The integration involves setting up the text editor in your Rails views, configuring Active Storage for image uploads, and adding the necessary backend processing to convert the content to markdown and then to email-friendly HTML.
  5. Existing Solutions:

    • While there might not be a one-size-fits-all existing solution for this specific workflow, leveraging the combination of Rails capabilities with these JavaScript libraries and Ruby gems can efficiently achieve the desired functionality.

This approach balances the flexibility of a customized solution with the robustness of well-supported libraries and frameworks.

Relevant Docs