@flint.fyi/markdown-language 0.17.0 → 0.17.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/dist/index.d.mts +3 -57
- package/dist/index.mjs +2 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { WithExitKeys } from "@flint.fyi/core";
|
|
1
|
+
import { Language, WithExitKeys } from "@flint.fyi/core";
|
|
2
2
|
import * as mdast from "mdast";
|
|
3
3
|
import { Point, Position } from "unist";
|
|
4
|
-
|
|
5
4
|
//#region src/nodes.d.ts
|
|
6
5
|
interface MarkdownNodesByName extends RootContentMapWithChildren {
|
|
7
6
|
root: WithPosition<mdast.Root>;
|
|
@@ -23,7 +22,7 @@ interface PositionWithOffsets extends Position {
|
|
|
23
22
|
/**
|
|
24
23
|
* A version of {@link mdast.RootContentMap} that includes position information for each node.
|
|
25
24
|
*/
|
|
26
|
-
type RootContentMapWithChildren = { [K in keyof mdast.RootContentMap]: WithPosition<mdast.RootContentMap[K]
|
|
25
|
+
type RootContentMapWithChildren = { [K in keyof mdast.RootContentMap]: WithPosition<mdast.RootContentMap[K]>; };
|
|
27
26
|
type WithPosition<T> = T & {
|
|
28
27
|
position: PositionWithOffsets;
|
|
29
28
|
};
|
|
@@ -32,59 +31,6 @@ type WithPosition<T> = T & {
|
|
|
32
31
|
interface MarkdownFileServices {
|
|
33
32
|
root: WithPosition<mdast.Root>;
|
|
34
33
|
}
|
|
35
|
-
declare const markdownLanguage:
|
|
36
|
-
root: WithPosition<mdast.Root>;
|
|
37
|
-
blockquote: WithPosition<mdast.Blockquote>;
|
|
38
|
-
break: WithPosition<mdast.Break>;
|
|
39
|
-
code: WithPosition<mdast.Code>;
|
|
40
|
-
definition: WithPosition<mdast.Definition>;
|
|
41
|
-
delete: WithPosition<mdast.Delete>;
|
|
42
|
-
emphasis: WithPosition<mdast.Emphasis>;
|
|
43
|
-
footnoteDefinition: WithPosition<mdast.FootnoteDefinition>;
|
|
44
|
-
footnoteReference: WithPosition<mdast.FootnoteReference>;
|
|
45
|
-
heading: WithPosition<mdast.Heading>;
|
|
46
|
-
html: WithPosition<mdast.Html>;
|
|
47
|
-
image: WithPosition<mdast.Image>;
|
|
48
|
-
imageReference: WithPosition<mdast.ImageReference>;
|
|
49
|
-
inlineCode: WithPosition<mdast.InlineCode>;
|
|
50
|
-
link: WithPosition<mdast.Link>;
|
|
51
|
-
linkReference: WithPosition<mdast.LinkReference>;
|
|
52
|
-
list: WithPosition<mdast.List>;
|
|
53
|
-
listItem: WithPosition<mdast.ListItem>;
|
|
54
|
-
paragraph: WithPosition<mdast.Paragraph>;
|
|
55
|
-
strong: WithPosition<mdast.Strong>;
|
|
56
|
-
table: WithPosition<mdast.Table>;
|
|
57
|
-
tableCell: WithPosition<mdast.TableCell>;
|
|
58
|
-
tableRow: WithPosition<mdast.TableRow>;
|
|
59
|
-
text: WithPosition<mdast.Text>;
|
|
60
|
-
thematicBreak: WithPosition<mdast.ThematicBreak>;
|
|
61
|
-
yaml: WithPosition<mdast.Yaml>;
|
|
62
|
-
"blockquote:exit": WithPosition<mdast.Blockquote>;
|
|
63
|
-
"break:exit": WithPosition<mdast.Break>;
|
|
64
|
-
"code:exit": WithPosition<mdast.Code>;
|
|
65
|
-
"definition:exit": WithPosition<mdast.Definition>;
|
|
66
|
-
"delete:exit": WithPosition<mdast.Delete>;
|
|
67
|
-
"emphasis:exit": WithPosition<mdast.Emphasis>;
|
|
68
|
-
"footnoteDefinition:exit": WithPosition<mdast.FootnoteDefinition>;
|
|
69
|
-
"footnoteReference:exit": WithPosition<mdast.FootnoteReference>;
|
|
70
|
-
"heading:exit": WithPosition<mdast.Heading>;
|
|
71
|
-
"html:exit": WithPosition<mdast.Html>;
|
|
72
|
-
"image:exit": WithPosition<mdast.Image>;
|
|
73
|
-
"imageReference:exit": WithPosition<mdast.ImageReference>;
|
|
74
|
-
"inlineCode:exit": WithPosition<mdast.InlineCode>;
|
|
75
|
-
"link:exit": WithPosition<mdast.Link>;
|
|
76
|
-
"linkReference:exit": WithPosition<mdast.LinkReference>;
|
|
77
|
-
"list:exit": WithPosition<mdast.List>;
|
|
78
|
-
"listItem:exit": WithPosition<mdast.ListItem>;
|
|
79
|
-
"paragraph:exit": WithPosition<mdast.Paragraph>;
|
|
80
|
-
"strong:exit": WithPosition<mdast.Strong>;
|
|
81
|
-
"table:exit": WithPosition<mdast.Table>;
|
|
82
|
-
"tableCell:exit": WithPosition<mdast.TableCell>;
|
|
83
|
-
"tableRow:exit": WithPosition<mdast.TableRow>;
|
|
84
|
-
"text:exit": WithPosition<mdast.Text>;
|
|
85
|
-
"thematicBreak:exit": WithPosition<mdast.ThematicBreak>;
|
|
86
|
-
"yaml:exit": WithPosition<mdast.Yaml>;
|
|
87
|
-
"root:exit": WithPosition<mdast.Root>;
|
|
88
|
-
}, MarkdownFileServices>;
|
|
34
|
+
declare const markdownLanguage: Language<MarkdownNodeVisitors, MarkdownFileServices>;
|
|
89
35
|
//#endregion
|
|
90
36
|
export { type MarkdownFileServices, type MarkdownNodeVisitors, type MarkdownNodesByName, type PointWithOffset, type PositionWithOffsets, type RootContentMapWithChildren, type WithPosition, markdownLanguage };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,8 @@ import { visit } from "unist-util-visit";
|
|
|
6
6
|
import { nullThrows } from "@flint.fyi/utils";
|
|
7
7
|
//#region src/directives/parseDirectivesFromMarkdownFile.ts
|
|
8
8
|
function parseDirectivesFromMarkdownFile(root, sourceText) {
|
|
9
|
-
const
|
|
9
|
+
const index = root.children.find((child) => child.position?.start.offset !== void 0)?.position?.start.offset ?? sourceText.length;
|
|
10
|
+
const collector = new DirectivesCollector(index);
|
|
10
11
|
visit(root, "html", (node) => {
|
|
11
12
|
const regex = /<!--([\s\S]*?)-->/g;
|
|
12
13
|
let commentMatch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/markdown-language",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "[Experimental] Markdown language for Flint.",
|
|
5
5
|
"homepage": "https://flint.fyi",
|
|
6
6
|
"repository": {
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@flint.fyi/core": "^0.26.0",
|
|
26
|
+
"@flint.fyi/utils": "^0.16.0",
|
|
25
27
|
"@types/mdast": "^4.0.4",
|
|
26
28
|
"@types/unist": "^3.0.3",
|
|
27
29
|
"mdast-util-from-markdown": "^2.0.2",
|
|
28
30
|
"mdast-util-gfm": "^3.1.0",
|
|
29
31
|
"micromark-extension-gfm": "^3.0.0",
|
|
30
|
-
"unist-util-visit": "^5.0.0"
|
|
31
|
-
"@flint.fyi/utils": "^0.16.0",
|
|
32
|
-
"@flint.fyi/core": "^0.25.0"
|
|
32
|
+
"unist-util-visit": "^5.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
35
|
+
"@flint.fyi/build": "^0.1.0",
|
|
36
|
+
"tsdown": "0.22.14",
|
|
37
|
+
"vitest": "4.1.11"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=26.1.0"
|