@chrisburnell/eleventy-cache-webmentions 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,7 @@ const epoch = (value) => {
41
41
  return new Date(value).getTime()
42
42
  }
43
43
 
44
- module.exports = (config, options = {}) => {
44
+ module.exports = (, options = {}) => {
45
45
  options = Object.assign(
46
46
  {
47
47
  duration: "23h",
@@ -152,8 +152,10 @@ module.exports = (config, options = {}) => {
152
152
  const { html, text } = entry.content
153
153
  if (html && html.length > options.maximumHtmlLength) {
154
154
  entry.content.value = `${options.maximumHtmlText} <a href="${entry["wm-source"]}">${entry["wm-source"]}</a>`
155
- } else {
155
+ } else if (Object.keys(options.allowedHTML).length) {
156
156
  entry.content.value = sanitizeHTML(html || text, options.allowedHTML)
157
+ } else {
158
+ entry.content.value = html || text
157
159
  }
158
160
  return entry
159
161
  })
@@ -174,13 +176,13 @@ module.exports = (config, options = {}) => {
174
176
  callback(null, webmentions)
175
177
  }
176
178
 
177
- if (config && options) {
179
+ if (eleventyConfig && options) {
178
180
  if (!options.domain) {
179
- throw new Error("domain is a required option to be passed when adding the plugin to your config using addPlugin.")
181
+ throw new Error("domain is a required option to be passed when adding the plugin to your eleventyConfig using addPlugin.")
180
182
  }
181
183
 
182
- config.addLiquidFilter("getWebmentions", getWebmentionsFilter)
183
- config.addNunjucksAsyncFilter("getWebmentions", getWebmentionsFilter)
184
+ eleventyConfig.addLiquidFilter("getWebmentions", getWebmentionsFilter)
185
+ eleventyConfig.addNunjucksAsyncFilter("getWebmentions", getWebmentionsFilter)
184
186
  } else {
185
187
  return filteredWebmentions
186
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisburnell/eleventy-cache-webmentions",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Cache webmentions from webmention.io using eleventy-cache-assets.",
5
5
  "main": "eleventy-cache-webmentions.js",
6
6
  "author": "Chris Burnell <me@chrisburnell.com>",