Skip to content

Commit

Permalink
Merge pull request #656 from kalamuna/kstat-178
Browse files Browse the repository at this point in the history
KSTAT-178: Add Markdown support
  • Loading branch information
RobLoach authored Mar 26, 2024
2 parents 5d2e700 + 3d2d193 commit 0d0a07e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/simple/pages/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<title>Kalastatic: Simple Test</title>
</head>
<body>
<h1>{{ text }}</h1>
{% apply markdown_to_html %}
# {{ text }}
{% endapply %}
</body>
</html>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/kalastatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from 'fs';
import { extname, basename, dirname } from 'path';
import Twig from "twig";
import twigMarkdown from 'twig-markdown';

import {
addDrupalExtensions
Expand All @@ -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) => {
Expand Down

0 comments on commit 0d0a07e

Please sign in to comment.