Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jan 3, 2023
1 parent a4bf849 commit 61dce94
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/docs/shortcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,27 @@ module.exports = function(eleventyConfig) {
};
```

### Asynchronous Universal Shortcodes

{% codetitle ".eleventy.js" %}

```js
module.exports = function(eleventyConfig) {
// Universal Asynchronous Shortcodes are added to:
// * Liquid
// * Nunjucks
// * JavaScript

// Async support for `addShortcode` and `addPairedShortcode` is new in Eleventy 2.0.0-canary.24
eleventyConfig.addShortcode("single", async function(myName) { /**/ });
eleventyConfig.addPairedShortcode("paired", async function(content, myName) { /**/ });

// Async methods available in Eleventy v0.10.0+
eleventyConfig.addAsyncShortcode("single", async function(myName) { /**/ });
eleventyConfig.addPairedAsyncShortcode("paired", async function(content, myName) { /**/ });
};
```

## Scoped Data in Shortcodes

A few Eleventy-specific data properties are available to shortcode callbacks.
Expand Down

0 comments on commit 61dce94

Please sign in to comment.