@mdfn/extensions 0.1.0
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 +5 -0
- package/dist/callout.cjs +153 -0
- package/dist/callout.cjs.map +1 -0
- package/dist/callout.d.cts +2 -0
- package/dist/callout.d.ts +2 -0
- package/dist/callout.js +7 -0
- package/dist/callout.js.map +1 -0
- package/dist/chunk-4I3JGYQE.js +135 -0
- package/dist/chunk-4I3JGYQE.js.map +1 -0
- package/dist/commonmark.cjs +153 -0
- package/dist/commonmark.cjs.map +1 -0
- package/dist/commonmark.d.cts +2 -0
- package/dist/commonmark.d.ts +2 -0
- package/dist/commonmark.js +7 -0
- package/dist/commonmark.js.map +1 -0
- package/dist/diagram.cjs +153 -0
- package/dist/diagram.cjs.map +1 -0
- package/dist/diagram.d.cts +2 -0
- package/dist/diagram.d.ts +2 -0
- package/dist/diagram.js +7 -0
- package/dist/diagram.js.map +1 -0
- package/dist/directives.cjs +153 -0
- package/dist/directives.cjs.map +1 -0
- package/dist/directives.d.cts +2 -0
- package/dist/directives.d.ts +2 -0
- package/dist/directives.js +7 -0
- package/dist/directives.js.map +1 -0
- package/dist/gfm.cjs +153 -0
- package/dist/gfm.cjs.map +1 -0
- package/dist/gfm.d.cts +2 -0
- package/dist/gfm.d.ts +2 -0
- package/dist/gfm.js +7 -0
- package/dist/gfm.js.map +1 -0
- package/dist/index.cjs +166 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
MDFN_EXTENSIONS_VERSION: () => MDFN_EXTENSIONS_VERSION,
|
|
24
|
+
authoringExtensions: () => authoringExtensions,
|
|
25
|
+
calloutExtension: () => calloutExtension,
|
|
26
|
+
commonmarkExtension: () => commonmarkExtension,
|
|
27
|
+
createDirectiveExtension: () => createDirectiveExtension,
|
|
28
|
+
defaultExtensions: () => defaultExtensions,
|
|
29
|
+
diagramExtension: () => diagramExtension,
|
|
30
|
+
gfmExtension: () => gfmExtension
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
|
+
var exactPreservation = {
|
|
34
|
+
noEdit: "exact",
|
|
35
|
+
edited: "touched-region",
|
|
36
|
+
unsupported: "opaque"
|
|
37
|
+
};
|
|
38
|
+
var commonmarkExtension = {
|
|
39
|
+
name: "commonmark",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
schema: {
|
|
42
|
+
nodes: ["doc", "paragraph", "heading", "blockquote", "list", "listItem", "codeBlock", "inlineCode", "thematicBreak", "hardBreak", "text", "strong", "emphasis", "link", "image", "opaque"],
|
|
43
|
+
marks: ["strong", "emphasis", "code", "link"]
|
|
44
|
+
},
|
|
45
|
+
preservation: exactPreservation,
|
|
46
|
+
security: { allowsRawHtml: false, urlSchemes: ["http", "https", "mailto"] }
|
|
47
|
+
};
|
|
48
|
+
var gfmExtension = {
|
|
49
|
+
name: "gfm",
|
|
50
|
+
version: "1.0.0",
|
|
51
|
+
dependencies: ["commonmark"],
|
|
52
|
+
schema: { nodes: ["table", "tableRow", "tableCell", "taskListItem", "delete"], marks: ["delete"] },
|
|
53
|
+
preservation: exactPreservation,
|
|
54
|
+
security: { allowsRawHtml: false, urlSchemes: ["http", "https", "mailto"] }
|
|
55
|
+
};
|
|
56
|
+
function directiveName(value) {
|
|
57
|
+
if (!/^[a-z][a-z0-9-]*$/.test(value)) throw new TypeError(`MDFN_DIRECTIVE_NAME_INVALID:${value}`);
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
function createDirectiveExtension(options) {
|
|
61
|
+
const name = directiveName(options.name);
|
|
62
|
+
const nodeType = `directive-${name}`;
|
|
63
|
+
return {
|
|
64
|
+
name: `directive/${name}`,
|
|
65
|
+
version: options.version ?? "1.0.0",
|
|
66
|
+
dependencies: ["commonmark"],
|
|
67
|
+
schema: { nodes: [nodeType] },
|
|
68
|
+
preservation: exactPreservation,
|
|
69
|
+
security: { allowsRawHtml: false },
|
|
70
|
+
parseMarkdown({ source, offset, line }) {
|
|
71
|
+
const opening = new RegExp(`^(:{3,})[ \\t]*${name}(?:[ \\t]+([^\\r\\n]*?))?[ \\t]*(?:\\r?\\n|\\r|$)`).exec(line);
|
|
72
|
+
if (!opening) return null;
|
|
73
|
+
const searchFrom = offset + line.length;
|
|
74
|
+
const closePattern = new RegExp(`^:{${opening[1].length},}[ \\t]*(?:\\r?\\n|\\r|$)`, "gm");
|
|
75
|
+
closePattern.lastIndex = searchFrom;
|
|
76
|
+
const close = closePattern.exec(source);
|
|
77
|
+
const closeEnd = close ? close.index + close[0].length : source.length;
|
|
78
|
+
const bodyEnd = close?.index ?? source.length;
|
|
79
|
+
const body = source.slice(searchFrom, bodyEnd).replace(/\r?\n$/, "");
|
|
80
|
+
return {
|
|
81
|
+
consumed: closeEnd - offset,
|
|
82
|
+
node: {
|
|
83
|
+
type: nodeType,
|
|
84
|
+
attrs: { name, label: opening[2]?.trim() || options.label || name },
|
|
85
|
+
text: body
|
|
86
|
+
},
|
|
87
|
+
diagnostics: close ? [] : [{ code: "MDFN_DIRECTIVE_UNCLOSED", message: `Directive ${name} has no closing fence`, severity: "warning", source: { from: offset, to: source.length }, extension: `directive/${name}` }]
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
serializeMarkdown({ node }) {
|
|
91
|
+
if (node.type !== nodeType) return null;
|
|
92
|
+
const label = typeof node.attrs?.label === "string" && node.attrs.label !== name ? ` ${node.attrs.label}` : "";
|
|
93
|
+
const body = node.text ?? "";
|
|
94
|
+
let fenceLength = 3;
|
|
95
|
+
for (const match of body.matchAll(/^(:{3,})[ \\t]*(?:\\r)?$/gm)) fenceLength = Math.max(fenceLength, match[1].length + 1);
|
|
96
|
+
const fence = ":".repeat(fenceLength);
|
|
97
|
+
return `${fence}${name}${label}
|
|
98
|
+
${body}
|
|
99
|
+
${fence}`;
|
|
100
|
+
},
|
|
101
|
+
render({ node }) {
|
|
102
|
+
if (node.type !== nodeType) return null;
|
|
103
|
+
const label = typeof node.attrs?.label === "string" ? node.attrs.label : options.label ?? name;
|
|
104
|
+
const classes = ["mdfn-directive", `mdfn-directive-${name}`, options.className].filter(Boolean).join(" ");
|
|
105
|
+
return {
|
|
106
|
+
tag: "aside",
|
|
107
|
+
attrs: { class: classes, "data-md-directive": name },
|
|
108
|
+
children: [
|
|
109
|
+
{ tag: "strong", text: label },
|
|
110
|
+
{ tag: "p", text: node.text ?? "" }
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
visual({ node }) {
|
|
115
|
+
if (node.type !== nodeType) return null;
|
|
116
|
+
const label = typeof node.attrs?.label === "string" ? node.attrs.label : options.label ?? name;
|
|
117
|
+
return {
|
|
118
|
+
tag: "aside",
|
|
119
|
+
attrs: { class: "mdfn-directive-visual", "data-md-directive": name },
|
|
120
|
+
children: [
|
|
121
|
+
{ tag: "strong", text: label },
|
|
122
|
+
{ tag: "p", text: node.text ?? "" }
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
diagnostics(document) {
|
|
127
|
+
const diagnostics = [];
|
|
128
|
+
const visit = (node) => {
|
|
129
|
+
if (node.type === nodeType && !(node.text ?? "").trim()) diagnostics.push({ code: "MDFN_DIRECTIVE_EMPTY", message: `Directive ${name} is empty`, severity: "warning", nodeId: node.id, extension: `directive/${name}` });
|
|
130
|
+
node.content?.forEach(visit);
|
|
131
|
+
};
|
|
132
|
+
visit(document);
|
|
133
|
+
return diagnostics;
|
|
134
|
+
},
|
|
135
|
+
migrations: [{
|
|
136
|
+
from: 1,
|
|
137
|
+
to: 2,
|
|
138
|
+
migrate(document) {
|
|
139
|
+
const migrate = (node) => node.type === `callout-${name}` ? { ...node, type: nodeType } : { ...node, content: node.content?.map(migrate) };
|
|
140
|
+
return { ...migrate(document), type: "doc", schemaVersion: 2 };
|
|
141
|
+
}
|
|
142
|
+
}],
|
|
143
|
+
certification: {
|
|
144
|
+
schemaVersion: 1,
|
|
145
|
+
fixtures: [`directive-${name}`],
|
|
146
|
+
capabilities: ["parse", "serialize", "render", "visual", "diagnostics", "migrations", "security"]
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
var calloutExtension = createDirectiveExtension({ name: "callout", label: "Callout" });
|
|
151
|
+
var diagramExtension = createDirectiveExtension({ name: "diagram", label: "Diagram" });
|
|
152
|
+
var defaultExtensions = Object.freeze([commonmarkExtension, gfmExtension]);
|
|
153
|
+
var authoringExtensions = Object.freeze([commonmarkExtension, gfmExtension, calloutExtension, diagramExtension]);
|
|
154
|
+
var MDFN_EXTENSIONS_VERSION = "0.1.0";
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
MDFN_EXTENSIONS_VERSION,
|
|
158
|
+
authoringExtensions,
|
|
159
|
+
calloutExtension,
|
|
160
|
+
commonmarkExtension,
|
|
161
|
+
createDirectiveExtension,
|
|
162
|
+
defaultExtensions,
|
|
163
|
+
diagramExtension,
|
|
164
|
+
gfmExtension
|
|
165
|
+
});
|
|
166
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { MdfnDocument, MdfnExtension, MdfnNode } from \"@mdfn/core\";\n\nconst exactPreservation = {\n noEdit: \"exact\",\n edited: \"touched-region\",\n unsupported: \"opaque\",\n} as const;\n\nexport const commonmarkExtension: MdfnExtension = {\n name: \"commonmark\",\n version: \"1.0.0\",\n schema: {\n nodes: [\"doc\", \"paragraph\", \"heading\", \"blockquote\", \"list\", \"listItem\", \"codeBlock\", \"inlineCode\", \"thematicBreak\", \"hardBreak\", \"text\", \"strong\", \"emphasis\", \"link\", \"image\", \"opaque\"],\n marks: [\"strong\", \"emphasis\", \"code\", \"link\"],\n },\n preservation: exactPreservation,\n security: { allowsRawHtml: false, urlSchemes: [\"http\", \"https\", \"mailto\"] },\n};\n\nexport const gfmExtension: MdfnExtension = {\n name: \"gfm\",\n version: \"1.0.0\",\n dependencies: [\"commonmark\"],\n schema: { nodes: [\"table\", \"tableRow\", \"tableCell\", \"taskListItem\", \"delete\"], marks: [\"delete\"] },\n preservation: exactPreservation,\n security: { allowsRawHtml: false, urlSchemes: [\"http\", \"https\", \"mailto\"] },\n};\n\nexport interface DirectiveExtensionOptions {\n readonly name: string;\n readonly label?: string;\n readonly className?: string;\n readonly version?: string;\n}\n\nfunction directiveName(value: string): string {\n if (!/^[a-z][a-z0-9-]*$/.test(value)) throw new TypeError(`MDFN_DIRECTIVE_NAME_INVALID:${value}`);\n return value;\n}\n\nexport function createDirectiveExtension(options: DirectiveExtensionOptions): MdfnExtension {\n const name = directiveName(options.name);\n const nodeType = `directive-${name}`;\n return {\n name: `directive/${name}`,\n version: options.version ?? \"1.0.0\",\n dependencies: [\"commonmark\"],\n schema: { nodes: [nodeType] },\n preservation: exactPreservation,\n security: { allowsRawHtml: false },\n parseMarkdown({ source, offset, line }) {\n const opening = new RegExp(`^(:{3,})[ \\\\t]*${name}(?:[ \\\\t]+([^\\\\r\\\\n]*?))?[ \\\\t]*(?:\\\\r?\\\\n|\\\\r|$)`).exec(line);\n if (!opening) return null;\n const searchFrom = offset + line.length;\n const closePattern = new RegExp(`^:{${opening[1].length},}[ \\\\t]*(?:\\\\r?\\\\n|\\\\r|$)`, \"gm\");\n closePattern.lastIndex = searchFrom;\n const close = closePattern.exec(source);\n const closeEnd = close ? close.index + close[0].length : source.length;\n const bodyEnd = close?.index ?? source.length;\n const body = source.slice(searchFrom, bodyEnd).replace(/\\r?\\n$/, \"\");\n return {\n consumed: closeEnd - offset,\n node: {\n type: nodeType,\n attrs: { name, label: opening[2]?.trim() || options.label || name },\n text: body,\n },\n diagnostics: close ? [] : [{ code: \"MDFN_DIRECTIVE_UNCLOSED\", message: `Directive ${name} has no closing fence`, severity: \"warning\", source: { from: offset, to: source.length }, extension: `directive/${name}` }],\n };\n },\n serializeMarkdown({ node }) {\n if (node.type !== nodeType) return null;\n const label = typeof node.attrs?.label === \"string\" && node.attrs.label !== name ? ` ${node.attrs.label}` : \"\";\n const body = node.text ?? \"\";\n let fenceLength = 3;\n for (const match of body.matchAll(/^(:{3,})[ \\\\t]*(?:\\\\r)?$/gm)) fenceLength = Math.max(fenceLength, match[1].length + 1);\n const fence = \":\".repeat(fenceLength);\n return `${fence}${name}${label}\\n${body}\\n${fence}`;\n },\n render({ node }) {\n if (node.type !== nodeType) return null;\n const label = typeof node.attrs?.label === \"string\" ? node.attrs.label : options.label ?? name;\n const classes = [\"mdfn-directive\", `mdfn-directive-${name}`, options.className].filter(Boolean).join(\" \");\n return {\n tag: \"aside\",\n attrs: { class: classes, \"data-md-directive\": name },\n children: [\n { tag: \"strong\", text: label },\n { tag: \"p\", text: node.text ?? \"\" },\n ],\n };\n },\n visual({ node }) {\n if (node.type !== nodeType) return null;\n const label = typeof node.attrs?.label === \"string\" ? node.attrs.label : options.label ?? name;\n return {\n tag: \"aside\",\n attrs: { class: \"mdfn-directive-visual\", \"data-md-directive\": name },\n children: [\n { tag: \"strong\", text: label },\n { tag: \"p\", text: node.text ?? \"\" },\n ],\n };\n },\n diagnostics(document) {\n const diagnostics: Array<{ code: string; message: string; severity: \"warning\"; nodeId?: string; extension: string }> = [];\n const visit = (node: MdfnNode): void => {\n if (node.type === nodeType && !(node.text ?? \"\").trim()) diagnostics.push({ code: \"MDFN_DIRECTIVE_EMPTY\", message: `Directive ${name} is empty`, severity: \"warning\", nodeId: node.id, extension: `directive/${name}` });\n node.content?.forEach(visit);\n };\n visit(document);\n return diagnostics;\n },\n migrations: [{\n from: 1,\n to: 2,\n migrate(document: MdfnDocument): MdfnDocument {\n const migrate = (node: MdfnNode): MdfnNode => node.type === `callout-${name}`\n ? { ...node, type: nodeType }\n : { ...node, content: node.content?.map(migrate) };\n return { ...migrate(document), type: \"doc\", schemaVersion: 2 } as MdfnDocument;\n },\n }],\n certification: {\n schemaVersion: 1,\n fixtures: [`directive-${name}`],\n capabilities: [\"parse\", \"serialize\", \"render\", \"visual\", \"diagnostics\", \"migrations\", \"security\"],\n },\n };\n}\n\nexport const calloutExtension = createDirectiveExtension({ name: \"callout\", label: \"Callout\" });\nexport const diagramExtension = createDirectiveExtension({ name: \"diagram\", label: \"Diagram\" });\n\nexport const defaultExtensions = Object.freeze([commonmarkExtension, gfmExtension]);\nexport const authoringExtensions = Object.freeze([commonmarkExtension, gfmExtension, calloutExtension, diagramExtension]);\n\nexport const MDFN_EXTENSIONS_VERSION = \"0.1.0\" as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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A,MAC7B;AACA,YAAM,QAAQ;AACd,aAAO;AAAA,IACT;AAAA,IACA,YAAY,CAAC;AAAA,MACX,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,QAAQ,UAAsC;AAC5C,cAAM,UAAU,CAAC,SAA6B,KAAK,SAAS,WAAW,IAAI,KACvE,EAAE,GAAG,MAAM,MAAM,SAAS,IAC1B,EAAE,GAAG,MAAM,SAAS,KAAK,SAAS,IAAI,OAAO,EAAE;AACnD,eAAO,EAAE,GAAG,QAAQ,QAAQ,GAAG,MAAM,OAAO,eAAe,EAAE;AAAA,MAC/D;AAAA,IACF,CAAC;AAAA,IACD,eAAe;AAAA,MACb,eAAe;AAAA,MACf,UAAU,CAAC,aAAa,IAAI,EAAE;AAAA,MAC9B,cAAc,CAAC,SAAS,aAAa,UAAU,UAAU,eAAe,cAAc,UAAU;AAAA,IAClG;AAAA,EACF;AACF;AAEO,IAAM,mBAAmB,yBAAyB,EAAE,MAAM,WAAW,OAAO,UAAU,CAAC;AACvF,IAAM,mBAAmB,yBAAyB,EAAE,MAAM,WAAW,OAAO,UAAU,CAAC;AAEvF,IAAM,oBAAoB,OAAO,OAAO,CAAC,qBAAqB,YAAY,CAAC;AAC3E,IAAM,sBAAsB,OAAO,OAAO,CAAC,qBAAqB,cAAc,kBAAkB,gBAAgB,CAAC;AAEjH,IAAM,0BAA0B;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MdfnExtension } from '@mdfn/core';
|
|
2
|
+
|
|
3
|
+
declare const commonmarkExtension: MdfnExtension;
|
|
4
|
+
declare const gfmExtension: MdfnExtension;
|
|
5
|
+
interface DirectiveExtensionOptions {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly label?: string;
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
readonly version?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function createDirectiveExtension(options: DirectiveExtensionOptions): MdfnExtension;
|
|
12
|
+
declare const calloutExtension: MdfnExtension;
|
|
13
|
+
declare const diagramExtension: MdfnExtension;
|
|
14
|
+
declare const defaultExtensions: readonly MdfnExtension[];
|
|
15
|
+
declare const authoringExtensions: readonly MdfnExtension[];
|
|
16
|
+
declare const MDFN_EXTENSIONS_VERSION: "0.1.0";
|
|
17
|
+
|
|
18
|
+
export { type DirectiveExtensionOptions, MDFN_EXTENSIONS_VERSION, authoringExtensions, calloutExtension, commonmarkExtension, createDirectiveExtension, defaultExtensions, diagramExtension, gfmExtension };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MdfnExtension } from '@mdfn/core';
|
|
2
|
+
|
|
3
|
+
declare const commonmarkExtension: MdfnExtension;
|
|
4
|
+
declare const gfmExtension: MdfnExtension;
|
|
5
|
+
interface DirectiveExtensionOptions {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly label?: string;
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
readonly version?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function createDirectiveExtension(options: DirectiveExtensionOptions): MdfnExtension;
|
|
12
|
+
declare const calloutExtension: MdfnExtension;
|
|
13
|
+
declare const diagramExtension: MdfnExtension;
|
|
14
|
+
declare const defaultExtensions: readonly MdfnExtension[];
|
|
15
|
+
declare const authoringExtensions: readonly MdfnExtension[];
|
|
16
|
+
declare const MDFN_EXTENSIONS_VERSION: "0.1.0";
|
|
17
|
+
|
|
18
|
+
export { type DirectiveExtensionOptions, MDFN_EXTENSIONS_VERSION, authoringExtensions, calloutExtension, commonmarkExtension, createDirectiveExtension, defaultExtensions, diagramExtension, gfmExtension };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MDFN_EXTENSIONS_VERSION,
|
|
3
|
+
authoringExtensions,
|
|
4
|
+
calloutExtension,
|
|
5
|
+
commonmarkExtension,
|
|
6
|
+
createDirectiveExtension,
|
|
7
|
+
defaultExtensions,
|
|
8
|
+
diagramExtension,
|
|
9
|
+
gfmExtension
|
|
10
|
+
} from "./chunk-4I3JGYQE.js";
|
|
11
|
+
export {
|
|
12
|
+
MDFN_EXTENSIONS_VERSION,
|
|
13
|
+
authoringExtensions,
|
|
14
|
+
calloutExtension,
|
|
15
|
+
commonmarkExtension,
|
|
16
|
+
createDirectiveExtension,
|
|
17
|
+
defaultExtensions,
|
|
18
|
+
diagramExtension,
|
|
19
|
+
gfmExtension
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mdfn/extensions",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Certified Markdown extension packs for mdfn",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" },
|
|
11
|
+
"./commonmark": { "types": "./dist/commonmark.d.ts", "import": "./dist/commonmark.js", "require": "./dist/commonmark.cjs" },
|
|
12
|
+
"./gfm": { "types": "./dist/gfm.d.ts", "import": "./dist/gfm.js", "require": "./dist/gfm.cjs" },
|
|
13
|
+
"./callout": { "types": "./dist/callout.d.ts", "import": "./dist/callout.js", "require": "./dist/callout.cjs" },
|
|
14
|
+
"./diagram": { "types": "./dist/diagram.d.ts", "import": "./dist/diagram.js", "require": "./dist/diagram.cjs" },
|
|
15
|
+
"./directives": { "types": "./dist/directives.d.ts", "import": "./dist/directives.js", "require": "./dist/directives.cjs" }
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup src/index.ts src/commonmark.ts src/gfm.ts src/callout.ts src/diagram.ts src/directives.ts --format esm,cjs --dts --sourcemap --clean",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
21
|
+
"lint": "tsc --noEmit -p tsconfig.json",
|
|
22
|
+
"prepack": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": { "@mdfn/core": "0.1.0" },
|
|
25
|
+
"devDependencies": { "@mdfn/markdown": "0.1.0", "@mdfn/render": "0.1.0", "@mdfn/testing": "0.1.0", "tsup": "^8.0.0", "typescript": "^5.3.0", "vitest": "3.2.4" },
|
|
26
|
+
"files": ["dist", "README.md"],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"engines": { "node": ">=20 <25" },
|
|
29
|
+
"repository": { "type": "git", "url": "git+https://github.com/21nCo/super-functions.git", "directory": "mdfn/extensions" },
|
|
30
|
+
"publishConfig": { "access": "public" },
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"mdfn": { "status": "stable-candidate", "layer": "extensions", "schemaVersion": 1 }
|
|
33
|
+
}
|