@pretextbook/ptxast-util-to-mdast 0.0.7 → 0.0.9

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/README.md CHANGED
@@ -11,7 +11,10 @@ npm install @pretextbook/ptxast-util-to-mdast
11
11
  ## Use
12
12
 
13
13
  ```ts
14
- import { ptxastToMdast, ptxastToMarkdown } from '@pretextbook/ptxast-util-to-mdast';
14
+ import {
15
+ ptxastToMdast,
16
+ ptxastToMarkdown,
17
+ } from "@pretextbook/ptxast-util-to-mdast";
15
18
 
16
19
  // Convert a ptxast root to mdast
17
20
  const mdast = ptxastToMdast(ptxRoot);
package/dist/index.js CHANGED
@@ -5,7 +5,9 @@ import { mathToMarkdown as _ } from "mdast-util-math";
5
5
  const g = /* @__PURE__ */ new Set([
6
6
  ...b,
7
7
  ...T.filter((e) => !I(e))
8
- ]), k = new Set(S), v = /* @__PURE__ */ new Set([
8
+ ]), k = new Set(
9
+ S
10
+ ), v = /* @__PURE__ */ new Set([
9
11
  "pretext",
10
12
  "book",
11
13
  "article",
@@ -80,7 +82,9 @@ function h(e, t) {
80
82
  if (v.has(r.name) || k.has(r.name))
81
83
  i.push(...h(r.children, t));
82
84
  else if (g.has(r.name))
83
- i.push(...M(r, Math.min(t, 6)));
85
+ i.push(
86
+ ...M(r, Math.min(t, 6))
87
+ );
84
88
  else {
85
89
  const c = u(r);
86
90
  c !== null && i.push(c);
@@ -162,7 +166,9 @@ function j(e) {
162
166
  }
163
167
  function R(e) {
164
168
  const t = e.children;
165
- return t.length > 0 && t[0].type === "text" ? { type: "math", value: p(e) } : { type: "math", value: t.filter((n) => n.type === "element" && n.name === "mrow").map((n) => p(n)).join(` \\\\
169
+ return t.length > 0 && t[0].type === "text" ? { type: "math", value: p(e) } : { type: "math", value: t.filter(
170
+ (n) => n.type === "element" && n.name === "mrow"
171
+ ).map((n) => p(n)).join(` \\\\
166
172
  `) };
167
173
  }
168
174
  function Y(e, t) {
@@ -214,7 +220,10 @@ function Y(e, t) {
214
220
  }
215
221
  function f(e) {
216
222
  if (e.type === "text")
217
- return { type: "text", value: e.value ?? "" };
223
+ return {
224
+ type: "text",
225
+ value: e.value ?? ""
226
+ };
218
227
  if (e.type !== "element") return null;
219
228
  const t = e;
220
229
  switch (t.name) {
package/index.cjs CHANGED
@@ -1 +1 @@
1
- module.exports = require('./dist/index.cjs');
1
+ module.exports = require("./dist/index.cjs");
package/index.js CHANGED
@@ -1 +1 @@
1
- export * from './dist/index.js';
1
+ export * from "./dist/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretextbook/ptxast-util-to-mdast",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Convert ptxast to mdast (markdown AST) and markdown strings",
5
5
  "author": "Oscar Levin",
6
6
  "license": "GPL-3.0-or-later",
@@ -39,7 +39,7 @@
39
39
  "test": "vitest run"
40
40
  },
41
41
  "dependencies": {
42
- "@pretextbook/ptxast": "^0.0.7",
42
+ "@pretextbook/ptxast": "^0.1.0",
43
43
  "@types/mdast": "^4.0.0",
44
44
  "mdast-util-directive": "^3.0.0",
45
45
  "mdast-util-math": "^3.0.0",