question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Add preprocessor support

See original GitHub issue

From @watzon on November 8, 2017 21:15

Laravel gives us the ability to have blade templates that take blade/markdown and turn it into an HTML email template. This saves some major headache when it comes to making emails beautiful and responsive. It would be awesome if Adonis had the same functionality.

Proposal

Add a markdown method to the Mailer and some built in components that get added to edge templates. Developers should ideally be able to use the markdown method to render an edge template, or send plain markdown which will be parsed into valid email HTML before being sent.

Example Code

<!-- resources/views/emails/shipped.edge -->

@component('mail.message')
# Order Shipped

Your order has been shipped!

@component('mail.button', url = {{ order.viewUrl }})
View Order
@endcomponent

Thanks,<br>
{{ Config('appName') }}
@endcomponent
// app/Controllers/Http/OrdersController.js

await Mail.markdown('emails.shipped', Order.toJSON(), (message) => {
  message.subject('Hello ...')
  message.from('foo@bar.com')
  message.to('baz@bar.com')
})

Reference

https://laravel.com/docs/5.5/mail#markdown-mailables https://www.npmjs.com/package/markdown https://www.npmjs.com/package/markdown-it

Copied from original issue: adonisjs/adonis-mail#15

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
thetutlagecommented, Nov 10, 2017

So Adonis mail doesn’t have any idea on how the view engine works, it just uses Edge. My plan is to let users add preprocessors to Edge, so it will be like this

Raw edge

const edge = require('edge.js')
edge.use('mail/*.edge', function (content) {
  // return parsed content
})

In Adonis

const View = use('View')
View.use('mail/*.edge', function (content) {
  // return parsed content
})
0reactions
thetutlagecommented, Mar 23, 2021

Idea dropped. Closing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preprocessor Options (Using the GNU Compiler Collection ...
This feature is used in automatic updating of makefiles. -Mno-modules. Disable dependency generation for compiled module interfaces. -MP. This option instructs ...
Read more >
MSVC new preprocessor overview - Microsoft Learn
Starting in Visual Studio 2019 version 16.5, preprocessor support for the C++20 standard is feature-complete. These changes are available by ...
Read more >
Is it wrong to add preprocessor directives in a function-like ...
c++ - Is it wrong to add preprocessor directives in a function-like macro? - Stack Overflow. Stack Overflow for Teams – Start collaborating...
Read more >
Feature testing (since C++20) - cppreference.com
Feature testing (since C++20)​​ The standard defines a set of preprocessor macros corresponding to C++ language and library features introduced ...
Read more >
C99 preprocessor features adopted in C++11 (C++11) - IBM
Note: IBM® supports selected features of C++11, known as C++0x before its ratification. IBM will continue to develop and implement the features of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found