-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to render the email with layout? #9
Comments
You should be able to specify a layout as you normally would without the gem. If that doesn't happen, can you give me a super simple example of a new rails app that shows the problem? |
Wondering the same here. |
Again, you would do it the same way as if you were not using maildown. If that doesn't happen, can you give me a super simple example of a new rails app that shows the problem? |
@schneems Verifying that this is true. Test app here: https://github.com/tjschuck/maildown_layout_test Pull it down, It should say "SOMETHING IN THE LAYOUT", but doesn't. Step-by-step, just check the commits in order after the first one. |
The problem here is actually in how rails renders layouts. The extensions and mime types must match. To fix change the layout to a |
Here's a PR that enables the layout tjschuck/maildown_layout_test#1 |
Btw, if someone could give me a PR with this information in the README I would owe you many ❤️s |
@schneems Oh, yeah, I already knew that changing the layout to .md would fix it. But you can't really make an HTML layout for an email in Markdown :) It would be nice if the HTML/text versions of the emails would still respect their layouts, but the content could be written (once) in MD. |
How so? By default markdown supports html, but the problem would be your text version would show up with the raw html and look awful. What in your ideal world would you like to happen? Why wouldn't you want to write your the template to your markdown email in markdown? This library is implemented in a relatively hacky way as this part of ActionMailer was never meant to be extended, there is much we cannot change (easily) like how Rails handles templates. If I can better understand exactly what you want it might be possible to get to a workaround that achieves those goals, or to maybe build some features. |
This is the problem. The HTML that you would want in an HTML email (but not a plaintext one) would be design related HTML. Header images, CSS, etc. |
interesting so maybe only apply |
Yeah, it's supposed to use the correct layout for the correct format. See http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-layouts, first example + comment: class UserMailer < ActionMailer::Base
layout 'awesome' # use awesome.(html|text).erb as the layout
end It would be nice if the email content could be .md, get rendered into HTML/text versions via maildown, and have each format respect its parent layout. |
This gem is really good, but.. how to user a layout to render the content within?
we have
/layouts/email.html.haml
but this email is not used by maildown, how to get it to load the html email with this layout?
The text was updated successfully, but these errors were encountered: