@pretextbook/ptxast-util-to-mdast 0.0.1 → 0.0.2
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 +35 -35
- package/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +53 -53
package/README.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
# @pretextbook/ptxast-util-to-mdast
|
|
2
|
-
|
|
3
|
-
Convert [ptxast](../ptxast) (PreTeXt AST) to [mdast](https://github.com/syntax-tree/mdast) (Markdown AST) and Markdown strings. Part of the [pretext-tools](https://github.com/pretextbook/pretext-tools) unified.js ecosystem.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install @pretextbook/ptxast-util-to-mdast
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Use
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { ptxastToMdast, ptxastToMarkdown } from '@pretextbook/ptxast-util-to-mdast';
|
|
15
|
-
|
|
16
|
-
// Convert a ptxast root to mdast
|
|
17
|
-
const mdast = ptxastToMdast(ptxRoot);
|
|
18
|
-
|
|
19
|
-
// Or convert directly to a markdown string
|
|
20
|
-
const markdown = ptxastToMarkdown(ptxRoot);
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## API
|
|
24
|
-
|
|
25
|
-
### `ptxastToMdast(root: PtxRoot): Root`
|
|
26
|
-
|
|
27
|
-
Converts a `PtxRoot` tree to an mdast `Root` tree with directive nodes for PreTeXt block environments.
|
|
28
|
-
|
|
29
|
-
### `ptxastToMarkdown(root: PtxRoot): string`
|
|
30
|
-
|
|
31
|
-
Converts a `PtxRoot` tree to a Markdown string. Theorem-like environments render as `:::theorem` directive fences; divisions render as ATX headings (`##`).
|
|
32
|
-
|
|
33
|
-
## License
|
|
34
|
-
|
|
35
|
-
GPL-3.0-or-later
|
|
1
|
+
# @pretextbook/ptxast-util-to-mdast
|
|
2
|
+
|
|
3
|
+
Convert [ptxast](../ptxast) (PreTeXt AST) to [mdast](https://github.com/syntax-tree/mdast) (Markdown AST) and Markdown strings. Part of the [pretext-tools](https://github.com/pretextbook/pretext-tools) unified.js ecosystem.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @pretextbook/ptxast-util-to-mdast
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { ptxastToMdast, ptxastToMarkdown } from '@pretextbook/ptxast-util-to-mdast';
|
|
15
|
+
|
|
16
|
+
// Convert a ptxast root to mdast
|
|
17
|
+
const mdast = ptxastToMdast(ptxRoot);
|
|
18
|
+
|
|
19
|
+
// Or convert directly to a markdown string
|
|
20
|
+
const markdown = ptxastToMarkdown(ptxRoot);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### `ptxastToMdast(root: PtxRoot): Root`
|
|
26
|
+
|
|
27
|
+
Converts a `PtxRoot` tree to an mdast `Root` tree with directive nodes for PreTeXt block environments.
|
|
28
|
+
|
|
29
|
+
### `ptxastToMarkdown(root: PtxRoot): string`
|
|
30
|
+
|
|
31
|
+
Converts a `PtxRoot` tree to a Markdown string. Theorem-like environments render as `:::theorem` directive fences; divisions render as ATX headings (`##`).
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
GPL-3.0-or-later
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('../../dist/packages/ptxast-util-to-mdast/index.cjs');
|
|
1
|
+
module.exports = require('../../dist/packages/ptxast-util-to-mdast/index.cjs');
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '../../dist/packages/ptxast-util-to-mdast/index.d.ts';
|
|
1
|
+
export * from '../../dist/packages/ptxast-util-to-mdast/index.d.ts';
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '../../dist/packages/ptxast-util-to-mdast/index.js';
|
|
1
|
+
export * from '../../dist/packages/ptxast-util-to-mdast/index.js';
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pretextbook/ptxast-util-to-mdast",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Convert ptxast to mdast (markdown AST) and markdown strings",
|
|
5
|
-
"author": "Oscar Levin",
|
|
6
|
-
"license": "GPL-3.0-or-later",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
10
|
-
"directory": "packages/ptxast-util-to-mdast"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
14
|
-
},
|
|
15
|
-
"homepage": "https://github.com/
|
|
16
|
-
"private": false,
|
|
17
|
-
"type": "module",
|
|
18
|
-
"main": "./index.cjs",
|
|
19
|
-
"module": "./index.js",
|
|
20
|
-
"types": "./index.d.ts",
|
|
21
|
-
"exports": {
|
|
22
|
-
".": {
|
|
23
|
-
"types": "./index.d.ts",
|
|
24
|
-
"import": "./index.js",
|
|
25
|
-
"require": "./index.cjs",
|
|
26
|
-
"default": "./index.js"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"sideEffects": false,
|
|
30
|
-
"files": [
|
|
31
|
-
"*.js",
|
|
32
|
-
"*.cjs",
|
|
33
|
-
"*.d.ts",
|
|
34
|
-
"*.d.cts",
|
|
35
|
-
"lib"
|
|
36
|
-
],
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "vite build",
|
|
39
|
-
"test": "vitest run"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@pretextbook/ptxast": "^0.0.
|
|
43
|
-
"@types/mdast": "^4.0.0",
|
|
44
|
-
"mdast-util-directive": "^3.0.0",
|
|
45
|
-
"mdast-util-math": "^3.0.0",
|
|
46
|
-
"mdast-util-to-markdown": "^2.0.0",
|
|
47
|
-
"xast-util-from-xml": "^4.0.0",
|
|
48
|
-
"xast-util-to-xml": "^4.0.0"
|
|
49
|
-
},
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"access": "public"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pretextbook/ptxast-util-to-mdast",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Convert ptxast to mdast (markdown AST) and markdown strings",
|
|
5
|
+
"author": "Oscar Levin",
|
|
6
|
+
"license": "GPL-3.0-or-later",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/PreTeXtBook/pretext-tools.git",
|
|
10
|
+
"directory": "packages/ptxast-util-to-mdast"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/PreTeXtBook/pretext-tools/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/PreTeXtBook/pretext-tools/packages/ptxast-util-to-mdast#readme",
|
|
16
|
+
"private": false,
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./index.cjs",
|
|
19
|
+
"module": "./index.js",
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"import": "./index.js",
|
|
25
|
+
"require": "./index.cjs",
|
|
26
|
+
"default": "./index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"files": [
|
|
31
|
+
"*.js",
|
|
32
|
+
"*.cjs",
|
|
33
|
+
"*.d.ts",
|
|
34
|
+
"*.d.cts",
|
|
35
|
+
"lib"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "vite build",
|
|
39
|
+
"test": "vitest run"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@pretextbook/ptxast": "^0.0.2",
|
|
43
|
+
"@types/mdast": "^4.0.0",
|
|
44
|
+
"mdast-util-directive": "^3.0.0",
|
|
45
|
+
"mdast-util-math": "^3.0.0",
|
|
46
|
+
"mdast-util-to-markdown": "^2.0.0",
|
|
47
|
+
"xast-util-from-xml": "^4.0.0",
|
|
48
|
+
"xast-util-to-xml": "^4.0.0"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
}
|
|
53
|
+
}
|