diff --git a/examples/simple/pages/index.html.twig b/examples/simple/pages/index.html.twig index 1dd42e6..528520f 100644 --- a/examples/simple/pages/index.html.twig +++ b/examples/simple/pages/index.html.twig @@ -5,6 +5,8 @@ Kalastatic: Simple Test -

{{ text }}

+ {% apply markdown_to_html %} + # {{ text }} + {% endapply %} diff --git a/package.json b/package.json index 99d0e90..ff5892c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "drupal-twig-extensions": "^1.0.0-beta.4", "meow": "^12.0.1", "sass": "^1.58.3", - "twig": "^1.16.0" + "twig": "^1.16.0", + "twig-markdown": "^1.1.0" }, "scripts": { "test": "bin/kalastatic.js examples/simple", diff --git a/src/kalastatic.js b/src/kalastatic.js index f8cf031..60e430c 100644 --- a/src/kalastatic.js +++ b/src/kalastatic.js @@ -4,6 +4,7 @@ import { } from 'fs'; import { extname, basename, dirname } from 'path'; import Twig from "twig"; +import twigMarkdown from 'twig-markdown'; import { addDrupalExtensions @@ -14,7 +15,9 @@ import { promisify } from "util"; const sassRenderPromise = promisify(sass.render); let namespaceFiles = []; +// Add the Twig extensions. addDrupalExtensions(Twig); +Twig.extend(twigMarkdown); // Finds twig pages in a directory and returns an array of filenames export const findTwigPages = async (directory) => {