lens-content-processor 0.25.0 → 0.27.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/dist/flattener/resolve-text-links.d.ts +1 -1
- package/dist/flattener/resolve-text-links.js +61 -32
- package/dist/flattener/resolve-text-links.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/parser/lens.js +2 -3
- package/dist/parser/lens.js.map +1 -1
- package/dist/parser/sections.d.ts +2 -2
- package/dist/parser/sections.js +76 -45
- package/dist/parser/sections.js.map +1 -1
- package/dist/validator/directives.d.ts +3 -6
- package/dist/validator/directives.js +137 -119
- package/dist/validator/directives.js.map +1 -1
- package/dist/validator/math.d.ts +3 -0
- package/dist/validator/math.js +86 -0
- package/dist/validator/math.js.map +1 -0
- package/package.json +2 -1
package/dist/parser/sections.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ALL_KNOWN_FIELDS } from
|
|
2
|
-
import { levenshtein } from
|
|
1
|
+
import { ALL_KNOWN_FIELDS } from "../content-schema.js";
|
|
2
|
+
import { levenshtein } from "../validator/field-typos.js";
|
|
3
3
|
// Valid section types per file type (exported for use by other parsers)
|
|
4
|
-
export const MODULE_SECTION_TYPES = new Set([
|
|
5
|
-
export const LO_SECTION_TYPES = new Set([
|
|
4
|
+
export const MODULE_SECTION_TYPES = new Set(["learning outcome", "lens"]);
|
|
5
|
+
export const LO_SECTION_TYPES = new Set(["lens", "test"]);
|
|
6
6
|
// Legacy: Lens H3 section types (no longer used — lenses are now flat H4 segments)
|
|
7
|
-
export const LENS_SECTION_TYPES = new Set([
|
|
7
|
+
export const LENS_SECTION_TYPES = new Set(["page", "article", "video"]);
|
|
8
8
|
// All known structural header types (sections + segments) for markdown heading detection
|
|
9
9
|
// NOTE: deliberately does NOT include the survey-only segment types
|
|
10
10
|
// (rating/choice). Real survey headers are consumed as section boundaries
|
|
@@ -13,17 +13,30 @@ export const LENS_SECTION_TYPES = new Set(['page', 'article', 'video']);
|
|
|
13
13
|
// headings like "## Rating" inside content:: fields.
|
|
14
14
|
const ALL_STRUCTURAL_TYPES = new Set([
|
|
15
15
|
// Section types
|
|
16
|
-
|
|
16
|
+
"learning outcome",
|
|
17
|
+
"lens",
|
|
18
|
+
"test",
|
|
19
|
+
"module",
|
|
20
|
+
"meeting",
|
|
21
|
+
"article",
|
|
22
|
+
"video",
|
|
17
23
|
// Segment types
|
|
18
|
-
|
|
24
|
+
"text",
|
|
25
|
+
"chat",
|
|
26
|
+
"question",
|
|
27
|
+
"roleplay",
|
|
19
28
|
]);
|
|
20
29
|
// Fields that commonly contain markdown with headings
|
|
21
|
-
const MARKDOWN_CONTENT_FIELDS = new Set([
|
|
30
|
+
const MARKDOWN_CONTENT_FIELDS = new Set([
|
|
31
|
+
"content",
|
|
32
|
+
"instructions",
|
|
33
|
+
"ai-instructions",
|
|
34
|
+
]);
|
|
22
35
|
// Map input section names to output types for Lens files
|
|
23
36
|
export const LENS_OUTPUT_TYPE = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
page: "page",
|
|
38
|
+
article: "lens-article",
|
|
39
|
+
video: "lens-video",
|
|
27
40
|
};
|
|
28
41
|
/**
|
|
29
42
|
* Parse sections from markdown content based on header hierarchy.
|
|
@@ -35,11 +48,11 @@ export const LENS_OUTPUT_TYPE = {
|
|
|
35
48
|
* @param flat - When true, all matching headers are siblings (for segments).
|
|
36
49
|
* When false, deeper headers nest inside preceding siblings (for sections).
|
|
37
50
|
*/
|
|
38
|
-
export function parseSections(content, parentLevel, validTypes, file =
|
|
51
|
+
export function parseSections(content, parentLevel, validTypes, file = "", flat = false) {
|
|
39
52
|
const minLevel = parentLevel + 1;
|
|
40
53
|
// Match any header from minLevel to 6 with named capture groups
|
|
41
|
-
const HEADER_PATTERN = new RegExp(`^(?<hashes>#{${minLevel},6})\\s+(?<type>[^:]+?)(?:\\:\\s*(?<title>.*?))?\\s*$`,
|
|
42
|
-
const lines = content.split(
|
|
54
|
+
const HEADER_PATTERN = new RegExp(`^(?<hashes>#{${minLevel},6})\\s+(?<type>[^:]+?)(?:\\:\\s*(?<title>.*?))?\\s*$`, "i");
|
|
55
|
+
const lines = content.split("\n");
|
|
43
56
|
const sections = [];
|
|
44
57
|
const errors = [];
|
|
45
58
|
let currentSection = null;
|
|
@@ -49,13 +62,13 @@ export function parseSections(content, parentLevel, validTypes, file = '', flat
|
|
|
49
62
|
function finalizeSection() {
|
|
50
63
|
if (!currentSection)
|
|
51
64
|
return;
|
|
52
|
-
currentSection.body = currentBody.join(
|
|
65
|
+
currentSection.body = currentBody.join("\n");
|
|
53
66
|
const { warnings } = parseFields(currentSection, file);
|
|
54
67
|
errors.push(...warnings);
|
|
55
68
|
// Submodule sections get recursive children parsing
|
|
56
|
-
if (currentSection.type ===
|
|
69
|
+
if (currentSection.type === "submodule") {
|
|
57
70
|
const childValidTypes = new Set([...validTypes]);
|
|
58
|
-
childValidTypes.delete(
|
|
71
|
+
childValidTypes.delete("submodule"); // No nesting
|
|
59
72
|
const childResult = parseSections(currentSection.body, currentSection.level, childValidTypes, file);
|
|
60
73
|
currentSection.children = childResult.sections;
|
|
61
74
|
errors.push(...childResult.errors);
|
|
@@ -71,19 +84,24 @@ export function parseSections(content, parentLevel, validTypes, file = '', flat
|
|
|
71
84
|
const headerLevel = hashes.length;
|
|
72
85
|
const rawType = headerMatch.groups.type.trim();
|
|
73
86
|
const normalizedType = rawType.toLowerCase();
|
|
74
|
-
const title = (headerMatch.groups.title ??
|
|
87
|
+
const title = (headerMatch.groups.title ?? "").trim();
|
|
75
88
|
// Check if this type is valid for the current context
|
|
76
89
|
if (!validTypes.has(normalizedType)) {
|
|
77
90
|
// Only error for unknown types at sibling level (not deeper body content)
|
|
78
|
-
const wouldBeSibling = flat ||
|
|
91
|
+
const wouldBeSibling = flat ||
|
|
92
|
+
currentSiblingLevel === 0 ||
|
|
93
|
+
headerLevel <= currentSiblingLevel;
|
|
79
94
|
if (wouldBeSibling) {
|
|
80
|
-
const capitalized = [...validTypes].map(t => t
|
|
95
|
+
const capitalized = [...validTypes].map((t) => t
|
|
96
|
+
.split(" ")
|
|
97
|
+
.map((w) => w[0].toUpperCase() + w.slice(1))
|
|
98
|
+
.join(" "));
|
|
81
99
|
errors.push({
|
|
82
100
|
file,
|
|
83
101
|
line: lineNum,
|
|
84
102
|
message: `Unknown section type: ${rawType}`,
|
|
85
|
-
suggestion: `Valid types: ${capitalized.join(
|
|
86
|
-
severity:
|
|
103
|
+
suggestion: `Valid types: ${capitalized.join(", ")}`,
|
|
104
|
+
severity: "error",
|
|
87
105
|
});
|
|
88
106
|
}
|
|
89
107
|
// Treat as body content of current section
|
|
@@ -94,7 +112,9 @@ export function parseSections(content, parentLevel, validTypes, file = '', flat
|
|
|
94
112
|
}
|
|
95
113
|
// Sibling boundary rule (hierarchical mode only):
|
|
96
114
|
// Deeper headers go into the preceding sibling's body
|
|
97
|
-
if (!flat &&
|
|
115
|
+
if (!flat &&
|
|
116
|
+
currentSiblingLevel > 0 &&
|
|
117
|
+
headerLevel > currentSiblingLevel) {
|
|
98
118
|
currentBody.push(line);
|
|
99
119
|
continue;
|
|
100
120
|
}
|
|
@@ -102,11 +122,11 @@ export function parseSections(content, parentLevel, validTypes, file = '', flat
|
|
|
102
122
|
finalizeSection();
|
|
103
123
|
currentSiblingLevel = headerLevel;
|
|
104
124
|
currentSection = {
|
|
105
|
-
type: normalizedType.replaceAll(
|
|
125
|
+
type: normalizedType.replaceAll(" ", "-"),
|
|
106
126
|
title,
|
|
107
127
|
rawType,
|
|
108
128
|
fields: {},
|
|
109
|
-
body:
|
|
129
|
+
body: "",
|
|
110
130
|
line: lineNum,
|
|
111
131
|
level: headerLevel,
|
|
112
132
|
};
|
|
@@ -125,9 +145,9 @@ export function parseSections(content, parentLevel, validTypes, file = '', flat
|
|
|
125
145
|
errors.push({
|
|
126
146
|
file,
|
|
127
147
|
line: lineNum,
|
|
128
|
-
message:
|
|
129
|
-
suggestion:
|
|
130
|
-
severity:
|
|
148
|
+
message: "Content found before first section header — this text will be ignored",
|
|
149
|
+
suggestion: "Move this text into a section, or remove it",
|
|
150
|
+
severity: "error",
|
|
131
151
|
});
|
|
132
152
|
}
|
|
133
153
|
}
|
|
@@ -139,7 +159,7 @@ export function parseSections(content, parentLevel, validTypes, file = '', flat
|
|
|
139
159
|
}
|
|
140
160
|
const FIELD_PATTERN = /^([\w-]+)::\s*(.*)$/;
|
|
141
161
|
function parseFields(section, file) {
|
|
142
|
-
const lines = section.body.split(
|
|
162
|
+
const lines = section.body.split("\n");
|
|
143
163
|
const warnings = [];
|
|
144
164
|
const seenFields = new Set();
|
|
145
165
|
let currentField = null;
|
|
@@ -156,23 +176,30 @@ function parseFields(section, file) {
|
|
|
156
176
|
if (currentField && MARKDOWN_CONTENT_FIELDS.has(currentField)) {
|
|
157
177
|
const headingText = headerMatch[2].trim();
|
|
158
178
|
// Extract type word: "Text", "Chat: title", "Article-excerpt" etc.
|
|
159
|
-
const typeWord = headingText.replace(/:.*$/,
|
|
179
|
+
const typeWord = headingText.replace(/:.*$/, "").trim().toLowerCase();
|
|
160
180
|
// Also check if it's a typo of a structural type (levenshtein ≤ 2)
|
|
161
|
-
const isTypoOfStructural = [...ALL_STRUCTURAL_TYPES].some(st => levenshtein(typeWord, st) <= 2);
|
|
181
|
+
const isTypoOfStructural = [...ALL_STRUCTURAL_TYPES].some((st) => levenshtein(typeWord, st) <= 2);
|
|
162
182
|
if (!ALL_STRUCTURAL_TYPES.has(typeWord) && !isTypoOfStructural) {
|
|
183
|
+
if (headerMatch[1].length >= 2) {
|
|
184
|
+
// H2+ Markdown headings belong to the active markdown field. H1
|
|
185
|
+
// remains a document boundary because modules and lenses use it
|
|
186
|
+
// for top-level structure.
|
|
187
|
+
currentValue.push(line);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
163
190
|
const hashes = headerMatch[1];
|
|
164
191
|
warnings.push({
|
|
165
192
|
file,
|
|
166
193
|
line: lineNum,
|
|
167
194
|
message: `'${hashes} ${headingText}' looks like a Markdown heading inside ${currentField}:: field`,
|
|
168
195
|
suggestion: `Escape it as '!${hashes} ${headingText}' so it's treated as content, not a section boundary`,
|
|
169
|
-
severity:
|
|
196
|
+
severity: "warning",
|
|
170
197
|
});
|
|
171
198
|
}
|
|
172
199
|
}
|
|
173
200
|
// Save current field if any
|
|
174
201
|
if (currentField) {
|
|
175
|
-
section.fields[currentField] = currentValue.join(
|
|
202
|
+
section.fields[currentField] = currentValue.join("\n").trim();
|
|
176
203
|
currentField = null;
|
|
177
204
|
currentValue = [];
|
|
178
205
|
}
|
|
@@ -185,7 +212,7 @@ function parseFields(section, file) {
|
|
|
185
212
|
if (match) {
|
|
186
213
|
// Save previous field if any
|
|
187
214
|
if (currentField) {
|
|
188
|
-
section.fields[currentField] = currentValue.join(
|
|
215
|
+
section.fields[currentField] = currentValue.join("\n").trim();
|
|
189
216
|
}
|
|
190
217
|
currentField = match[1];
|
|
191
218
|
const inlineValue = match[2].trim();
|
|
@@ -197,7 +224,7 @@ function parseFields(section, file) {
|
|
|
197
224
|
line: lineNum,
|
|
198
225
|
message: `Duplicate field '${currentField}' (previous value will be overwritten)`,
|
|
199
226
|
suggestion: `Remove the duplicate '${currentField}::' definition`,
|
|
200
|
-
severity:
|
|
227
|
+
severity: "error",
|
|
201
228
|
});
|
|
202
229
|
}
|
|
203
230
|
seenFields.add(currentField);
|
|
@@ -210,38 +237,42 @@ function parseFields(section, file) {
|
|
|
210
237
|
// Not inside a field — check for single-colon that should be double-colon
|
|
211
238
|
// Only suggest field:: if the word is a known field name
|
|
212
239
|
const singleColonMatch = line.match(/^(\w+):\s+(.*)$/);
|
|
213
|
-
if (singleColonMatch &&
|
|
240
|
+
if (singleColonMatch &&
|
|
241
|
+
!line.match(/^https?:/) &&
|
|
242
|
+
ALL_KNOWN_FIELDS.includes(singleColonMatch[1])) {
|
|
214
243
|
warnings.push({
|
|
215
244
|
file,
|
|
216
245
|
line: lineNum,
|
|
217
246
|
message: `Found '${singleColonMatch[1]}:' with single colon — did you mean '${singleColonMatch[1]}::'?`,
|
|
218
247
|
suggestion: `Change '${singleColonMatch[1]}:' to '${singleColonMatch[1]}::' (double colon)`,
|
|
219
|
-
severity:
|
|
248
|
+
severity: "error",
|
|
220
249
|
});
|
|
221
250
|
}
|
|
222
251
|
else if (line.trim() && !freeTextWarned) {
|
|
223
252
|
freeTextWarned = true;
|
|
224
|
-
const preview = line.trim().length > 60
|
|
253
|
+
const preview = line.trim().length > 60
|
|
254
|
+
? line.trim().slice(0, 60) + "..."
|
|
255
|
+
: line.trim();
|
|
225
256
|
warnings.push({
|
|
226
257
|
file,
|
|
227
258
|
line: lineNum,
|
|
228
259
|
message: `Text outside of a field:: definition will be ignored: "${preview}"`,
|
|
229
|
-
suggestion:
|
|
230
|
-
severity:
|
|
260
|
+
suggestion: "Place this text inside a field (e.g., content:: your text), or remove it",
|
|
261
|
+
severity: "error",
|
|
231
262
|
});
|
|
232
263
|
}
|
|
233
264
|
}
|
|
234
265
|
}
|
|
235
266
|
// Save final field
|
|
236
267
|
if (currentField) {
|
|
237
|
-
section.fields[currentField] = currentValue.join(
|
|
268
|
+
section.fields[currentField] = currentValue.join("\n").trim();
|
|
238
269
|
}
|
|
239
|
-
// Unescape \# → # at start of lines in markdown content fields.
|
|
240
|
-
//
|
|
241
|
-
//
|
|
270
|
+
// Unescape \# or !# → # at start of lines in markdown content fields.
|
|
271
|
+
// Both forms prevent structural-header parsing. The validator recommends !#;
|
|
272
|
+
// \# remains supported for existing content.
|
|
242
273
|
for (const field of MARKDOWN_CONTENT_FIELDS) {
|
|
243
274
|
if (section.fields[field]) {
|
|
244
|
-
section.fields[field] = section.fields[field].replace(
|
|
275
|
+
section.fields[field] = section.fields[field].replace(/^[\\!](#+)/gm, "$1");
|
|
245
276
|
}
|
|
246
277
|
}
|
|
247
278
|
return { warnings };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sections.js","sourceRoot":"","sources":["../../src/parser/sections.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAmB1D,wEAAwE;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1D,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAExE,yFAAyF;AACzF,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,0EAA0E;AAC1E,qDAAqD;AACrD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,gBAAgB;IAChB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"sections.js","sourceRoot":"","sources":["../../src/parser/sections.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAmB1D,wEAAwE;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1D,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAExE,yFAAyF;AACzF,oEAAoE;AACpE,0EAA0E;AAC1E,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;oBACb,OAAO,EAAE,0DAA0D,OAAO,GAAG;oBAC7E,UAAU,EACR,0EAA0E;oBAC5E,QAAQ,EAAE,OAAO;iBAClB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,mBAAmB;IACnB,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAChE,CAAC;IAED,sEAAsE;IACtE,6EAA6E;IAC7E,6CAA6C;IAC7C,KAAK,MAAM,KAAK,IAAI,uBAAuB,EAAE,CAAC;QAC5C,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CACnD,cAAc,EACd,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { ContentError } from
|
|
1
|
+
import type { ContentError } from "../index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Main validator for article body content.
|
|
4
4
|
* Checks for unclosed containers, unsupported names, empty containers,
|
|
5
5
|
* attribute typos, and {open} on closing markers.
|
|
6
6
|
*/
|
|
7
7
|
export declare function validateDirectives(body: string, file: string, bodyStartLine: number): ContentError[];
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
* Returns a single warning per match since directives won't render outside articles.
|
|
11
|
-
*/
|
|
12
|
-
export declare function detectDirectivesInNonArticle(content: string, file: string, line: number): ContentError[];
|
|
8
|
+
/** Validate directives in lens-authored text segments. */
|
|
9
|
+
export declare function validateLensDirectives(content: string, file: string, line: number): ContentError[];
|