-
Notifications
You must be signed in to change notification settings - Fork 649
Deprecation: legacy macro
Taylor Hunt edited this page Aug 2, 2019
·
9 revisions
The <macro>
core tag’s syntax has changed to be consistent with the new tag parameters, for providing values to body content.
The old syntax:
<macro greeting(firstName, lastName)>
Hello ${firstName} ${lastName}!
</macro>
<greeting firstName="Michael" lastName="Rawlings"/>
<greeting("Michael", "Rawlings"/>
…now looks like this:
<macro|{ firstName, lastName }| name="greeting">
Hello ${firstName} ${lastName}!
</macro>
<greeting firstName="Michael" lastName="Rawlings"/>
The <macro-body>
tag is now unnecessary, as the parameters provided to <macro>
are consistent with those provided to a template. You can render the body content of the modern <macro>
tag like so:
<macro|{ renderBody }| name="heading">
<h1 class="fancy-heading">
<${renderBody}/>
</h1>
</macro>
<heading>Hello!</heading>
To automatically fix deprecated marko syntax, try the marko migrate
command from the CLI.