@moonwave99/goffre 0.0.5 → 0.0.7

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.
Files changed (2) hide show
  1. package/lib/goffre.js +12 -2
  2. package/package.json +1 -1
package/lib/goffre.js CHANGED
@@ -58,8 +58,12 @@ export function getSlug(slug, params) {
58
58
  .join("/");
59
59
  }
60
60
 
61
- export function getTemplate({ page, templates, defaultTemplate = "_default" }) {
62
- if (page.template) {
61
+ export function getTemplate({
62
+ page,
63
+ templates = [],
64
+ defaultTemplate = "_default",
65
+ }) {
66
+ if (templates.find((x) => x === `${page.template}.handlebars`)) {
63
67
  return page.template;
64
68
  }
65
69
  if (templates.find((x) => x.startsWith(page.slug))) {
@@ -227,6 +231,12 @@ export async function render({
227
231
  env: { ...getEnv(), ...env },
228
232
  };
229
233
 
234
+ if (markdown.middleware) {
235
+ markdown.middleware.forEach((x) =>
236
+ marked.use(typeof x === "function" ? x() : x),
237
+ );
238
+ }
239
+
230
240
  marked.use(markdown);
231
241
 
232
242
  switch (logLevel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonwave99/goffre",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Mini static site generator",
5
5
  "author": {
6
6
  "name": "Diego Caponera",