@kenjura/ursa 0.79.0 → 0.80.1
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 +10 -0
- package/package.json +5 -1
- package/src/helper/mdxRenderer.js +40 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# 0.80.1
|
|
2
|
+
2026-02-16
|
|
3
|
+
|
|
4
|
+
- Fixed package.json issue
|
|
5
|
+
|
|
6
|
+
# 0.80.0
|
|
7
|
+
2026-02-16
|
|
8
|
+
|
|
9
|
+
- Added remark extensions to ensure MDX has the same extended markdown features as regular markdown (e.g. footnotes, definition lists, etc.)
|
|
10
|
+
|
|
1
11
|
# 0.79.0
|
|
2
12
|
2026-02-14
|
|
3
13
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@kenjura/ursa",
|
|
3
3
|
"author": "Andrew London <andrew@kenjura.com>",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.80.1",
|
|
6
6
|
"description": "static site generator from MD/wikitext/YML",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -39,7 +39,11 @@
|
|
|
39
39
|
"object-to-xml": "^2.0.0",
|
|
40
40
|
"react": "^19.2.4",
|
|
41
41
|
"react-dom": "^19.2.4",
|
|
42
|
+
"remark-definition-list": "^2.0.0",
|
|
43
|
+
"remark-directive": "^4.0.0",
|
|
44
|
+
"remark-supersub": "^1.0.0",
|
|
42
45
|
"sharp": "^0.33.2",
|
|
46
|
+
"unist-util-visit": "^5.1.0",
|
|
43
47
|
"ws": "^8.19.0",
|
|
44
48
|
"yaml": "^2.1.3",
|
|
45
49
|
"yargs": "^17.7.2"
|
|
@@ -4,6 +4,26 @@ import React from "react";
|
|
|
4
4
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
5
5
|
import { dirname, join, resolve } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
|
+
import remarkDirective from "remark-directive";
|
|
8
|
+
import { remarkDefinitionList, defListHastHandlers } from "remark-definition-list";
|
|
9
|
+
import remarkSupersub from "remark-supersub";
|
|
10
|
+
import { visit } from "unist-util-visit";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Custom remark plugin that converts container directives (:::name ... :::)
|
|
14
|
+
* into <aside> HTML elements, matching the markdown-it-container behavior
|
|
15
|
+
* used in the .md pipeline (markdownHelper.cjs).
|
|
16
|
+
*/
|
|
17
|
+
function remarkAsideContainers() {
|
|
18
|
+
return (tree) => {
|
|
19
|
+
visit(tree, (node) => {
|
|
20
|
+
if (node.type === "containerDirective") {
|
|
21
|
+
const data = node.data || (node.data = {});
|
|
22
|
+
data.hName = "aside";
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
7
27
|
|
|
8
28
|
/**
|
|
9
29
|
* Find _components directories by walking up from the MDX file to the source root.
|
|
@@ -85,6 +105,26 @@ export async function renderMDX({ source, filePath, sourceRoot }) {
|
|
|
85
105
|
esbuildOptions,
|
|
86
106
|
// mdx-bundler uses gray-matter internally for frontmatter
|
|
87
107
|
mdxOptions(options) {
|
|
108
|
+
// Add remark plugins matching the markdown-it extensions in markdownHelper.cjs:
|
|
109
|
+
// - remarkDirective: parses :::name container syntax into AST nodes
|
|
110
|
+
// - remarkAsideContainers: converts container directives to <aside> elements
|
|
111
|
+
// - remarkDefinitionList: adds PHP Markdown Extra style definition lists (Term\n: Def)
|
|
112
|
+
// - remarkSupersub: adds ^superscript^ and ~subscript~ syntax
|
|
113
|
+
options.remarkPlugins = [
|
|
114
|
+
...(options.remarkPlugins || []),
|
|
115
|
+
remarkDirective,
|
|
116
|
+
remarkAsideContainers,
|
|
117
|
+
remarkDefinitionList,
|
|
118
|
+
remarkSupersub,
|
|
119
|
+
];
|
|
120
|
+
// remark-definition-list needs custom handlers for remark-rehype conversion
|
|
121
|
+
options.remarkRehypeOptions = {
|
|
122
|
+
...(options.remarkRehypeOptions || {}),
|
|
123
|
+
handlers: {
|
|
124
|
+
...(options.remarkRehypeOptions?.handlers || {}),
|
|
125
|
+
...defListHastHandlers,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
88
128
|
return options;
|
|
89
129
|
},
|
|
90
130
|
});
|