@shgysk8zer0/11ty-netlify 1.0.3 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
  <!-- markdownlint-disable -->
7
7
  ## [Unreleased]
8
8
 
9
+ ## [v1.0.4] - 2023-06-01
10
+
11
+ ### Fixed
12
+ - Add missing CommonJS version of `markdown-it` & `highlight.js` config
13
+
9
14
  ## [v1.0.3] - 2023-06-01
10
15
 
11
16
  ### Added
package/markdown.cjs ADDED
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var MarkdownIt = require('markdown-it');
4
+ var hljs = require('highlight.js');
5
+
6
+ /* eslint-env node */
7
+
8
+
9
+ const markdownIt = new MarkdownIt({
10
+ html: true,
11
+ linkify: false,
12
+ breaks: true,
13
+ langPrefix: 'language-',
14
+ highlight: function(str, language) {
15
+ if (typeof str === 'string' && typeof hljs.getLanguage(language) !== 'undefined') {
16
+ try {
17
+ return `<pre class="hljs ${this.langPrefix}${language}"><code>${hljs.highlight(str, { language, ignoreIllegals: true }).value}</code></pre>`;
18
+ } catch(e) {
19
+ console.error(e);
20
+ return `<pre class="hljs"><code>${this.utils.escapeHtml(str)}</code></pre>`;
21
+ }
22
+ } else {
23
+ return `<pre class="hljs"><code>${this.utils.escapeHtml(str)}</code></pre>`;
24
+ }
25
+ }
26
+ });
27
+
28
+ exports.markdownIt = markdownIt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgysk8zer0/11ty-netlify",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "engines": {
5
5
  "node": ">=18.13.0"
6
6
  },
@@ -19,6 +19,7 @@
19
19
  "scripts": {
20
20
  "test": "npm run lint && npm run build",
21
21
  "preversion": "npm test",
22
+ "prepare": "npm run build:markdown",
22
23
  "create:lock": "npm i --package-lock-only",
23
24
  "version:bump": "npm run version:bump:patch",
24
25
  "version:bump:patch": "npm version --no-git-tag-version patch",