@driftsys/markspec 0.3.0 → 0.4.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/esm/formatter/mod.d.ts +7 -2
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +10 -8
- package/esm/mod.d.ts +3 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -2
- package/esm/model/mod.d.ts +2 -0
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +1 -0
- package/esm/model/palette.d.ts +18 -0
- package/esm/model/palette.d.ts.map +1 -0
- package/esm/model/palette.js +23 -0
- package/esm/parser/markdown.d.ts +10 -3
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +18 -4
- package/esm/parser/mod.js +3 -3
- package/esm/parser/source.js +1 -1
- package/esm/profile/colors.d.ts +26 -0
- package/esm/profile/colors.d.ts.map +1 -0
- package/esm/profile/colors.js +46 -0
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +2 -17
- package/esm/profile/mod.d.ts +1 -0
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +1 -0
- package/package.json +1 -1
- package/script/formatter/mod.d.ts +7 -2
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +10 -8
- package/script/mod.d.ts +3 -3
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +3 -1
- package/script/model/mod.d.ts +2 -0
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +4 -1
- package/script/model/palette.d.ts +18 -0
- package/script/model/palette.d.ts.map +1 -0
- package/script/model/palette.js +26 -0
- package/script/parser/markdown.d.ts +10 -3
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +18 -4
- package/script/parser/mod.js +3 -3
- package/script/parser/source.js +1 -1
- package/script/profile/colors.d.ts +26 -0
- package/script/profile/colors.d.ts.map +1 -0
- package/script/profile/colors.js +49 -0
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +4 -19
- package/script/profile/mod.d.ts +1 -0
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +3 -1
package/esm/formatter/mod.d.ts
CHANGED
|
@@ -47,8 +47,13 @@ export declare function expandCsvValues(attrs: Attribute[]): Attribute[];
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function sortAttributes(attributes: Attribute[]): Attribute[];
|
|
49
49
|
/**
|
|
50
|
-
* Render attributes as indented
|
|
51
|
-
*
|
|
50
|
+
* Render attributes as an indented code block.
|
|
51
|
+
* Each line is `Key: Value` at (indent + 4) absolute columns;
|
|
52
|
+
* no trailing line-continuation characters.
|
|
53
|
+
*
|
|
54
|
+
* @param attributes - The attributes to render, in canonical order.
|
|
55
|
+
* @param indent - Body indent for the entry (2 for list-wrapped entries,
|
|
56
|
+
* 0 for entries inside source-file doc comments).
|
|
52
57
|
*/
|
|
53
58
|
export declare function renderAttributeBlock(attributes: Attribute[], indent: number): string;
|
|
54
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAyDzB,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;CACtC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,E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wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AA2BD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B5C"}
|
package/esm/formatter/mod.js
CHANGED
|
@@ -73,7 +73,7 @@ export function format(markdown, options) {
|
|
|
73
73
|
// body only (front-matter `---` could be confused with horizontal rules).
|
|
74
74
|
const fm = extractFrontMatter(markdown, { file });
|
|
75
75
|
const body = fm.hadFrontMatter ? fm.markdown : markdown;
|
|
76
|
-
const entries = parseMarkdown(body, { file });
|
|
76
|
+
const { entries } = parseMarkdown(body, { file });
|
|
77
77
|
const diagnostics = [...fm.diagnostics];
|
|
78
78
|
if (entries.length === 0 && !fm.hadFrontMatter) {
|
|
79
79
|
return { output: markdown, diagnostics, changed: false };
|
|
@@ -223,16 +223,18 @@ export function sortAttributes(attributes) {
|
|
|
223
223
|
return result;
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
|
-
* Render attributes as indented
|
|
227
|
-
*
|
|
226
|
+
* Render attributes as an indented code block.
|
|
227
|
+
* Each line is `Key: Value` at (indent + 4) absolute columns;
|
|
228
|
+
* no trailing line-continuation characters.
|
|
229
|
+
*
|
|
230
|
+
* @param attributes - The attributes to render, in canonical order.
|
|
231
|
+
* @param indent - Body indent for the entry (2 for list-wrapped entries,
|
|
232
|
+
* 0 for entries inside source-file doc comments).
|
|
228
233
|
*/
|
|
229
234
|
export function renderAttributeBlock(attributes, indent) {
|
|
230
|
-
const prefix = " ".repeat(indent);
|
|
235
|
+
const prefix = " ".repeat(indent + 4);
|
|
231
236
|
return attributes
|
|
232
|
-
.map((attr
|
|
233
|
-
const sep = i < attributes.length - 1 ? "\\" : "";
|
|
234
|
-
return `${prefix}${attr.key}: ${attr.value}${sep}`;
|
|
235
|
-
})
|
|
237
|
+
.map((attr) => `${prefix}${attr.key}: ${attr.value}`)
|
|
236
238
|
.join("\n");
|
|
237
239
|
}
|
|
238
240
|
/**
|
package/esm/mod.d.ts
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import "./_dnt.polyfills.js";
|
|
11
11
|
export declare const VERSION = "0.0.1";
|
|
12
|
-
export { ConfigError, DEFAULT_PROJECT_CONFIG, REFHUB_URL, } from "./model/mod.js";
|
|
13
|
-
export type { Attribute, Caption, ConfigFieldError, Diagnostic, Directive, DisplayId, EffectiveProfile, Entry, EntryShape, EntrySource, InlineRef, Link, LinkKind, ProfileChain, ProjectConfig, Severity, SourceLocation, Ulid, } from "./model/mod.js";
|
|
12
|
+
export { ConfigError, DEFAULT_PROJECT_CONFIG, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
|
|
13
|
+
export type { Attribute, Caption, ConfigFieldError, Diagnostic, Directive, DisplayId, EffectiveProfile, EffectiveTypeDef, Entry, EntryShape, EntrySource, InlineRef, Link, LinkKind, PaletteHue, ProfileChain, ProjectConfig, Severity, SourceLocation, Ulid, } from "./model/mod.js";
|
|
14
14
|
export { discoverProjectRoot, loadConfig, parseProjectConfig, } from "./config/mod.js";
|
|
15
15
|
export type { LoadConfigResult, ReadFile } from "./config/mod.js";
|
|
16
16
|
export { MARKSPEC_YAML_FILENAME, parseMarkspecYaml, readMarkspecYaml, } from "./config/markspec.js";
|
|
17
17
|
export type { MarkspecYaml, ParseMarkspecYamlResult, } from "./config/markspec.js";
|
|
18
|
-
export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
|
|
18
|
+
export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveEntryColor, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
|
|
19
19
|
export type { AppendFile, CacheLocation, GitCacheKeyInput, LoadChainOptions, LoadChainResult, LoadProfileForCommandResult, MergeResult, ParseManifestResult, ResolvedProfileSource, ResolveGitOptions, RunGit, RunGitResult, } from "./profile/mod.js";
|
|
20
20
|
export { detectCaptions, detectDirectives, detectInlineRefs, isSupportedExtension, loadGrammar, parse, parseFile, parseSource, } from "./parser/mod.js";
|
|
21
21
|
export type { DetectCaptionsOptions, DetectDirectivesOptions, DetectInlineRefsOptions, ParseFileResult, ParseOptions, ParseSourceOptions, ParseSourceResult, } from "./parser/mod.js";
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,qBAAqB,CAAC;AAG7B,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,IAAI,GACL,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,YAAY,E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AAe,EACf,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,EACN,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
import "./_dnt.polyfills.js";
|
|
11
11
|
export const VERSION = "0.0.1";
|
|
12
12
|
// Model types
|
|
13
|
-
export { ConfigError, DEFAULT_PROJECT_CONFIG, REFHUB_URL, } from "./model/mod.js";
|
|
13
|
+
export { ConfigError, DEFAULT_PROJECT_CONFIG, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
|
|
14
14
|
// Config
|
|
15
15
|
export { discoverProjectRoot, loadConfig, parseProjectConfig, } from "./config/mod.js";
|
|
16
16
|
export { MARKSPEC_YAML_FILENAME, parseMarkspecYaml, readMarkspecYaml, } from "./config/markspec.js";
|
|
17
17
|
// Profile system (ADR-008)
|
|
18
|
-
export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
|
|
18
|
+
export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveEntryColor, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
|
|
19
19
|
// Parser
|
|
20
20
|
export { detectCaptions, detectDirectives, detectInlineRefs, isSupportedExtension, loadGrammar, parse, parseFile, parseSource, } from "./parser/mod.js";
|
|
21
21
|
// Formatter
|
package/esm/model/mod.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
|
|
7
7
|
export type { AttributeSpec } from "./attributes.js";
|
|
8
|
+
export { COLOR_NAME_RE, PALETTE_HUES } from "./palette.js";
|
|
9
|
+
export type { PaletteHue } from "./palette.js";
|
|
8
10
|
/**
|
|
9
11
|
* Human-readable entry identifier from the `[...]` bracket marker.
|
|
10
12
|
*
|
package/esm/model/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/model/mod.ts"],"names":[],"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AAC;IACxC,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;CACzC;AAMD,YAAY,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/esm/model/mod.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* MarkSpec document model — AST types, ID types, and project configuration.
|
|
5
5
|
*/
|
|
6
6
|
export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
|
|
7
|
+
export { COLOR_NAME_RE, PALETTE_HUES } from "./palette.js";
|
|
7
8
|
/** Core-reserved identity attribute name. */
|
|
8
9
|
export const IDENTITY_KEY = "Id";
|
|
9
10
|
/** Regex matching a bare ULID (identified-entry `Id:` value). */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module model/palette
|
|
3
|
+
*
|
|
4
|
+
* The seven-hue entry color palette and its semantic-name regex. Single
|
|
5
|
+
* source of truth — both the profile manifest parser and the renderer
|
|
6
|
+
* import from here so the two layers can never drift.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
|
|
9
|
+
* tokens-side change followed by an entry here; the order does not matter
|
|
10
|
+
* but kept stable for diagnostic message readability.
|
|
11
|
+
*/
|
|
12
|
+
/** The seven palette hues a profile may bind a semantic color name to. */
|
|
13
|
+
export declare const PALETTE_HUES: readonly ["blue", "cyan", "teal", "orange", "red", "purple", "grey"];
|
|
14
|
+
/** Type of a palette hue name. */
|
|
15
|
+
export type PaletteHue = typeof PALETTE_HUES[number];
|
|
16
|
+
/** Regex for a valid semantic color-role name (key into `profile.colors:`). */
|
|
17
|
+
export declare const COLOR_NAME_RE: RegExp;
|
|
18
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/model/palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,YAAY,sEAQf,CAAC;AAEX,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAErD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,QAAsB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module model/palette
|
|
3
|
+
*
|
|
4
|
+
* The seven-hue entry color palette and its semantic-name regex. Single
|
|
5
|
+
* source of truth — both the profile manifest parser and the renderer
|
|
6
|
+
* import from here so the two layers can never drift.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
|
|
9
|
+
* tokens-side change followed by an entry here; the order does not matter
|
|
10
|
+
* but kept stable for diagnostic message readability.
|
|
11
|
+
*/
|
|
12
|
+
/** The seven palette hues a profile may bind a semantic color name to. */
|
|
13
|
+
export const PALETTE_HUES = [
|
|
14
|
+
"blue",
|
|
15
|
+
"cyan",
|
|
16
|
+
"teal",
|
|
17
|
+
"orange",
|
|
18
|
+
"red",
|
|
19
|
+
"purple",
|
|
20
|
+
"grey",
|
|
21
|
+
];
|
|
22
|
+
/** Regex for a valid semantic color-role name (key into `profile.colors:`). */
|
|
23
|
+
export const COLOR_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
package/esm/parser/markdown.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* CommonMark + MarkSpec extension parser. Walks the mdast AST to detect
|
|
5
5
|
* `- [DISPLAY_ID] Title` entry blocks and extract structured attributes.
|
|
6
6
|
*/
|
|
7
|
-
import type { Entry } from "../model/mod.js";
|
|
7
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
8
8
|
/** Options for {@linkcode parseMarkdown}. */
|
|
9
9
|
export interface ParseMarkdownOptions {
|
|
10
10
|
/** File path used in source locations. */
|
|
@@ -16,6 +16,13 @@ export interface ParseMarkdownOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
readonly isReferencesDoc?: boolean;
|
|
18
18
|
}
|
|
19
|
+
/** Result returned by {@linkcode parseMarkdown}. */
|
|
20
|
+
export interface ParseMarkdownResult {
|
|
21
|
+
/** Parsed entries found in the Markdown source. */
|
|
22
|
+
readonly entries: Entry[];
|
|
23
|
+
/** Parse-level diagnostics (e.g., deprecation warnings). */
|
|
24
|
+
readonly diagnostics: Diagnostic[];
|
|
25
|
+
}
|
|
19
26
|
/**
|
|
20
27
|
* Parse a Markdown string and return all MarkSpec entries found.
|
|
21
28
|
*
|
|
@@ -26,7 +33,7 @@ export interface ParseMarkdownOptions {
|
|
|
26
33
|
*
|
|
27
34
|
* @param markdown - Markdown source text
|
|
28
35
|
* @param options - Parse options (file path for source locations)
|
|
29
|
-
* @returns
|
|
36
|
+
* @returns Parsed entries and any parse-level diagnostics
|
|
30
37
|
*/
|
|
31
|
-
export declare function parseMarkdown(markdown: string, options?: ParseMarkdownOptions):
|
|
38
|
+
export declare function parseMarkdown(markdown: string, options?: ParseMarkdownOptions): ParseMarkdownResult;
|
|
32
39
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/parser/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAa,KAAK,EAAc,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/parser/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAa,UAAU,EAAE,KAAK,EAAc,MAAM,iBAAiB,CAAC;AAShF,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AA4BD,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC;CACpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,mBAAmB,CAsCrB"}
|
package/esm/parser/markdown.js
CHANGED
|
@@ -39,13 +39,14 @@ function findIdentityAttribute(attributes) {
|
|
|
39
39
|
*
|
|
40
40
|
* @param markdown - Markdown source text
|
|
41
41
|
* @param options - Parse options (file path for source locations)
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns Parsed entries and any parse-level diagnostics
|
|
43
43
|
*/
|
|
44
44
|
export function parseMarkdown(markdown, options) {
|
|
45
45
|
const file = options?.file ?? "<unknown>";
|
|
46
46
|
const isReferencesDoc = detectReferencesDocument(file, options?.isReferencesDoc);
|
|
47
47
|
const tree = processor.parse(markdown);
|
|
48
48
|
const entries = [];
|
|
49
|
+
const diagnostics = [];
|
|
49
50
|
// Collect link definition identifiers for shortcut reference exclusion.
|
|
50
51
|
const definitions = new Set(tree.children
|
|
51
52
|
.filter((n) => n.type === "definition")
|
|
@@ -58,12 +59,12 @@ export function parseMarkdown(markdown, options) {
|
|
|
58
59
|
if (list.ordered)
|
|
59
60
|
continue;
|
|
60
61
|
for (const item of list.children) {
|
|
61
|
-
const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc);
|
|
62
|
+
const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics);
|
|
62
63
|
if (entry)
|
|
63
64
|
entries.push(entry);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
return entries;
|
|
67
|
+
return { entries, diagnostics };
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
70
|
* Detect if a file is a references document.
|
|
@@ -80,8 +81,9 @@ function detectReferencesDocument(file, explicit) {
|
|
|
80
81
|
/**
|
|
81
82
|
* Attempt to extract a MarkSpec entry from a list item.
|
|
82
83
|
* Returns undefined if the list item is not an entry block.
|
|
84
|
+
* Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
|
|
83
85
|
*/
|
|
84
|
-
function extractEntry(item, markdown, file, definitions, isReferencesDoc) {
|
|
86
|
+
function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics) {
|
|
85
87
|
// Task list items (remark-gfm sets checked to true/false) are not entries.
|
|
86
88
|
if (item.checked != null)
|
|
87
89
|
return undefined;
|
|
@@ -142,6 +144,18 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc) {
|
|
|
142
144
|
const bodyContent = extractBodyContent(item, markdown);
|
|
143
145
|
const [body, attrLines] = splitBodyAndAttributes(bodyContent);
|
|
144
146
|
const attributes = parseAttributes(attrLines);
|
|
147
|
+
// Detect legacy paragraph + trailing-backslash attribute form and warn.
|
|
148
|
+
if (attributes.length > 0 &&
|
|
149
|
+
attrLines.some((line) => line.trimEnd().endsWith("\\"))) {
|
|
150
|
+
const entryLine = item.position?.start.line ?? 1;
|
|
151
|
+
diagnostics.push({
|
|
152
|
+
code: "MSL-DEPRECATED-ATTR-001",
|
|
153
|
+
severity: "warning",
|
|
154
|
+
message: "legacy attribute block (paragraph with trailing `\\`) is deprecated; " +
|
|
155
|
+
"run `markspec format` to convert to the canonical indented code block",
|
|
156
|
+
location: { file, line: entryLine, column: 1 },
|
|
157
|
+
});
|
|
158
|
+
}
|
|
145
159
|
// Discriminate shape by the `Id:` attribute's value format.
|
|
146
160
|
let shape;
|
|
147
161
|
let id;
|
package/esm/parser/mod.js
CHANGED
|
@@ -28,7 +28,7 @@ export { isSupportedExtension, loadGrammar } from "./grammars.js";
|
|
|
28
28
|
* @returns Array of parsed entries
|
|
29
29
|
*/
|
|
30
30
|
export function parse(markdown, options) {
|
|
31
|
-
return parseMarkdown(markdown, options);
|
|
31
|
+
return parseMarkdown(markdown, options).entries;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Detect if a file is a references document.
|
|
@@ -60,7 +60,7 @@ export async function parseFile(content, options) {
|
|
|
60
60
|
const fm = extractFrontMatter(content, { file: options.file });
|
|
61
61
|
const body = fm.hadFrontMatter ? fm.markdown : content;
|
|
62
62
|
const isReferencesDoc = isReferencesDocument(options.file);
|
|
63
|
-
const entries = parseMarkdown(body, {
|
|
63
|
+
const { entries, diagnostics: parseDiagnostics } = parseMarkdown(body, {
|
|
64
64
|
file: options.file,
|
|
65
65
|
isReferencesDoc,
|
|
66
66
|
});
|
|
@@ -74,7 +74,7 @@ export async function parseFile(content, options) {
|
|
|
74
74
|
return {
|
|
75
75
|
entries,
|
|
76
76
|
document,
|
|
77
|
-
diagnostics: fm.diagnostics,
|
|
77
|
+
diagnostics: [...fm.diagnostics, ...parseDiagnostics],
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
/**
|
package/esm/parser/source.js
CHANGED
|
@@ -27,7 +27,7 @@ export function parseSource(content, options) {
|
|
|
27
27
|
const entries = [];
|
|
28
28
|
for (const block of blocks) {
|
|
29
29
|
const markdown = wrapAsListItem(block.lines);
|
|
30
|
-
const parsed = parseMarkdown(markdown, { file });
|
|
30
|
+
const { entries: parsed } = parseMarkdown(markdown, { file });
|
|
31
31
|
for (const entry of parsed) {
|
|
32
32
|
const location = {
|
|
33
33
|
file,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/colors
|
|
3
|
+
*
|
|
4
|
+
* Profile-driven entry color resolution. Pure function that maps an entry
|
|
5
|
+
* and the active profile to a palette hue name (or `null` for uncolored).
|
|
6
|
+
*
|
|
7
|
+
* Lives in core/profile so both rendering layers (Typst PDF and HTML book)
|
|
8
|
+
* can call it without crossing the peer-module boundary defined in AGENTS.md.
|
|
9
|
+
*
|
|
10
|
+
* See docs/superpowers/specs/2026-05-06-profile-driven-entry-colors-design.md
|
|
11
|
+
* for the resolution table.
|
|
12
|
+
*/
|
|
13
|
+
import type { EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
|
+
import { type PaletteHue } from "../model/palette.js";
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the palette hue for an entry under the active profile.
|
|
17
|
+
*
|
|
18
|
+
* Returns `null` for referenced-shape entries (uncolored block).
|
|
19
|
+
* Returns a palette hue name for identified entries — using the type's
|
|
20
|
+
* declared color when available, falling back to `"blue"` otherwise.
|
|
21
|
+
*
|
|
22
|
+
* The fallback is the palette hue directly (not the `primary` semantic
|
|
23
|
+
* name) so the renderer works for files compiled without a profile.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveEntryColor(entry: Entry, profile: EffectiveProfile | undefined): PaletteHue | null;
|
|
26
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/profile/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKpE;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,UAAU,GAAG,IAAI,CAmBnB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/colors
|
|
3
|
+
*
|
|
4
|
+
* Profile-driven entry color resolution. Pure function that maps an entry
|
|
5
|
+
* and the active profile to a palette hue name (or `null` for uncolored).
|
|
6
|
+
*
|
|
7
|
+
* Lives in core/profile so both rendering layers (Typst PDF and HTML book)
|
|
8
|
+
* can call it without crossing the peer-module boundary defined in AGENTS.md.
|
|
9
|
+
*
|
|
10
|
+
* See docs/superpowers/specs/2026-05-06-profile-driven-entry-colors-design.md
|
|
11
|
+
* for the resolution table.
|
|
12
|
+
*/
|
|
13
|
+
import { PALETTE_HUES } from "../model/palette.js";
|
|
14
|
+
/** Default identified-entry hue when no profile / no type color resolves. */
|
|
15
|
+
const DEFAULT_HUE = "blue";
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the palette hue for an entry under the active profile.
|
|
18
|
+
*
|
|
19
|
+
* Returns `null` for referenced-shape entries (uncolored block).
|
|
20
|
+
* Returns a palette hue name for identified entries — using the type's
|
|
21
|
+
* declared color when available, falling back to `"blue"` otherwise.
|
|
22
|
+
*
|
|
23
|
+
* The fallback is the palette hue directly (not the `primary` semantic
|
|
24
|
+
* name) so the renderer works for files compiled without a profile.
|
|
25
|
+
*/
|
|
26
|
+
export function resolveEntryColor(entry, profile) {
|
|
27
|
+
if (entry.shape === "referenced")
|
|
28
|
+
return null;
|
|
29
|
+
if (!profile || !entry.type)
|
|
30
|
+
return DEFAULT_HUE;
|
|
31
|
+
const typeDef = profile.types.get(entry.type);
|
|
32
|
+
const colorName = typeDef?.value.color.value;
|
|
33
|
+
if (!colorName)
|
|
34
|
+
return DEFAULT_HUE;
|
|
35
|
+
const hueEntry = profile.colors.get(colorName);
|
|
36
|
+
if (!hueEntry)
|
|
37
|
+
return DEFAULT_HUE;
|
|
38
|
+
// Defense in depth: the manifest parser already enforces PALETTE_HUES, but
|
|
39
|
+
// EffectiveProfile can in principle be constructed programmatically (tests,
|
|
40
|
+
// future APIs) without going through parseManifest. Guard the cast so an
|
|
41
|
+
// invalid hue can never reach downstream interpolation.
|
|
42
|
+
const hue = hueEntry.value;
|
|
43
|
+
if (!PALETTE_HUES.includes(hue))
|
|
44
|
+
return DEFAULT_HUE;
|
|
45
|
+
return hue;
|
|
46
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAyGnE,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AA4tBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CAkNrB"}
|
package/esm/profile/manifest.js
CHANGED
|
@@ -6,23 +6,8 @@
|
|
|
6
6
|
* schema violations.
|
|
7
7
|
*/
|
|
8
8
|
import { parse as parseYaml } from "@std/yaml";
|
|
9
|
-
import { LIST_VALUE_TYPES, VALUE_TYPES, } from "../model/mod.js";
|
|
9
|
+
import { COLOR_NAME_RE, LIST_VALUE_TYPES, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
|
|
10
10
|
const VALUE_TYPE_SET = new Set(VALUE_TYPES);
|
|
11
|
-
/**
|
|
12
|
-
* The seven palette hues a profile may bind a semantic name to.
|
|
13
|
-
* Mirrors the `diagram:` group in `theme/tokens.yaml`.
|
|
14
|
-
*/
|
|
15
|
-
const PALETTE_HUES = [
|
|
16
|
-
"blue",
|
|
17
|
-
"cyan",
|
|
18
|
-
"teal",
|
|
19
|
-
"orange",
|
|
20
|
-
"red",
|
|
21
|
-
"purple",
|
|
22
|
-
"grey",
|
|
23
|
-
];
|
|
24
|
-
/** Regex for valid semantic-name keys in `profile.colors:`. */
|
|
25
|
-
const COLOR_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
26
11
|
const ALLOWED_ROOT_KEYS = new Set([
|
|
27
12
|
"id",
|
|
28
13
|
"version",
|
|
@@ -445,7 +430,7 @@ function parseColorsMap(raw, sourcePath, diagnostics) {
|
|
|
445
430
|
for (const [name, value] of Object.entries(raw)) {
|
|
446
431
|
if (!COLOR_NAME_RE.test(name)) {
|
|
447
432
|
diagnostics.push({
|
|
448
|
-
code: "PROFILE-
|
|
433
|
+
code: "MSL-PROFILE-COLOR-004",
|
|
449
434
|
severity: "error",
|
|
450
435
|
message: `profile.colors: '${name}' is not a valid semantic name (lowercase letters, digits, hyphens; must start with a letter)`,
|
|
451
436
|
location: { file: sourcePath, line: 1, column: 1 },
|
package/esm/profile/mod.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export { cacheDir } from "./cache.js";
|
|
|
20
20
|
export type { CacheEnv } from "./cache.js";
|
|
21
21
|
export { defaultRunNpm, resolveNpmSpecifier } from "./npm.js";
|
|
22
22
|
export type { ResolveNpmOptions, RunNpm } from "./npm.js";
|
|
23
|
+
export { resolveEntryColor } from "./colors.js";
|
|
23
24
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/profile/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,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f,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
package/esm/profile/mod.js
CHANGED
package/package.json
CHANGED
|
@@ -47,8 +47,13 @@ export declare function expandCsvValues(attrs: Attribute[]): Attribute[];
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function sortAttributes(attributes: Attribute[]): Attribute[];
|
|
49
49
|
/**
|
|
50
|
-
* Render attributes as indented
|
|
51
|
-
*
|
|
50
|
+
* Render attributes as an indented code block.
|
|
51
|
+
* Each line is `Key: Value` at (indent + 4) absolute columns;
|
|
52
|
+
* no trailing line-continuation characters.
|
|
53
|
+
*
|
|
54
|
+
* @param attributes - The attributes to render, in canonical order.
|
|
55
|
+
* @param indent - Body indent for the entry (2 for list-wrapped entries,
|
|
56
|
+
* 0 for entries inside source-file doc comments).
|
|
52
57
|
*/
|
|
53
58
|
export declare function renderAttributeBlock(attributes: Attribute[], indent: number): string;
|
|
54
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAyDzB,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;CACtC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA8Ed;AA8BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAmB/D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,EAAE,GACtB,SAAS,EAAE,CAmCb;AAED
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAyDzB,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;CACtC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA8Ed;AA8BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAmB/D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,EAAE,GACtB,SAAS,EAAE,CAmCb;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AA2BD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B5C"}
|
package/script/formatter/mod.js
CHANGED
|
@@ -80,7 +80,7 @@ function format(markdown, options) {
|
|
|
80
80
|
// body only (front-matter `---` could be confused with horizontal rules).
|
|
81
81
|
const fm = (0, frontmatter_js_1.extractFrontMatter)(markdown, { file });
|
|
82
82
|
const body = fm.hadFrontMatter ? fm.markdown : markdown;
|
|
83
|
-
const entries = (0, markdown_js_1.parseMarkdown)(body, { file });
|
|
83
|
+
const { entries } = (0, markdown_js_1.parseMarkdown)(body, { file });
|
|
84
84
|
const diagnostics = [...fm.diagnostics];
|
|
85
85
|
if (entries.length === 0 && !fm.hadFrontMatter) {
|
|
86
86
|
return { output: markdown, diagnostics, changed: false };
|
|
@@ -230,16 +230,18 @@ function sortAttributes(attributes) {
|
|
|
230
230
|
return result;
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
|
-
* Render attributes as indented
|
|
234
|
-
*
|
|
233
|
+
* Render attributes as an indented code block.
|
|
234
|
+
* Each line is `Key: Value` at (indent + 4) absolute columns;
|
|
235
|
+
* no trailing line-continuation characters.
|
|
236
|
+
*
|
|
237
|
+
* @param attributes - The attributes to render, in canonical order.
|
|
238
|
+
* @param indent - Body indent for the entry (2 for list-wrapped entries,
|
|
239
|
+
* 0 for entries inside source-file doc comments).
|
|
235
240
|
*/
|
|
236
241
|
function renderAttributeBlock(attributes, indent) {
|
|
237
|
-
const prefix = " ".repeat(indent);
|
|
242
|
+
const prefix = " ".repeat(indent + 4);
|
|
238
243
|
return attributes
|
|
239
|
-
.map((attr
|
|
240
|
-
const sep = i < attributes.length - 1 ? "\\" : "";
|
|
241
|
-
return `${prefix}${attr.key}: ${attr.value}${sep}`;
|
|
242
|
-
})
|
|
244
|
+
.map((attr) => `${prefix}${attr.key}: ${attr.value}`)
|
|
243
245
|
.join("\n");
|
|
244
246
|
}
|
|
245
247
|
/**
|
package/script/mod.d.ts
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import "./_dnt.polyfills.js";
|
|
11
11
|
export declare const VERSION = "0.0.1";
|
|
12
|
-
export { ConfigError, DEFAULT_PROJECT_CONFIG, REFHUB_URL, } from "./model/mod.js";
|
|
13
|
-
export type { Attribute, Caption, ConfigFieldError, Diagnostic, Directive, DisplayId, EffectiveProfile, Entry, EntryShape, EntrySource, InlineRef, Link, LinkKind, ProfileChain, ProjectConfig, Severity, SourceLocation, Ulid, } from "./model/mod.js";
|
|
12
|
+
export { ConfigError, DEFAULT_PROJECT_CONFIG, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
|
|
13
|
+
export type { Attribute, Caption, ConfigFieldError, Diagnostic, Directive, DisplayId, EffectiveProfile, EffectiveTypeDef, Entry, EntryShape, EntrySource, InlineRef, Link, LinkKind, PaletteHue, ProfileChain, ProjectConfig, Severity, SourceLocation, Ulid, } from "./model/mod.js";
|
|
14
14
|
export { discoverProjectRoot, loadConfig, parseProjectConfig, } from "./config/mod.js";
|
|
15
15
|
export type { LoadConfigResult, ReadFile } from "./config/mod.js";
|
|
16
16
|
export { MARKSPEC_YAML_FILENAME, parseMarkspecYaml, readMarkspecYaml, } from "./config/markspec.js";
|
|
17
17
|
export type { MarkspecYaml, ParseMarkspecYamlResult, } from "./config/markspec.js";
|
|
18
|
-
export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
|
|
18
|
+
export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveEntryColor, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
|
|
19
19
|
export type { AppendFile, CacheLocation, GitCacheKeyInput, LoadChainOptions, LoadChainResult, LoadProfileForCommandResult, MergeResult, ParseManifestResult, ResolvedProfileSource, ResolveGitOptions, RunGit, RunGitResult, } from "./profile/mod.js";
|
|
20
20
|
export { detectCaptions, detectDirectives, detectInlineRefs, isSupportedExtension, loadGrammar, parse, parseFile, parseSource, } from "./parser/mod.js";
|
|
21
21
|
export type { DetectCaptionsOptions, DetectDirectivesOptions, DetectInlineRefsOptions, ParseFileResult, ParseOptions, ParseSourceOptions, ParseSourceResult, } from "./parser/mod.js";
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources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AAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
package/script/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.report = exports.serializeCompileResult = exports.generateInverses = exports.compile = exports.validateValue = exports.validateTraceabilityForEntry = exports.validateAttributesForEntry = exports.validate = exports.runPipeline = exports.normalizeListValues = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.format = exports.parseSource = exports.parseFile = exports.parse = exports.loadGrammar = exports.isSupportedExtension = exports.detectInlineRefs = exports.detectDirectives = exports.detectCaptions = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.readMarkspecYaml = exports.parseMarkspecYaml = exports.MARKSPEC_YAML_FILENAME = exports.parseProjectConfig = exports.loadConfig = exports.discoverProjectRoot = exports.REFHUB_URL = exports.DEFAULT_PROJECT_CONFIG = exports.ConfigError = exports.VERSION = void 0;
|
|
3
|
+
exports.report = exports.serializeCompileResult = exports.generateInverses = exports.compile = exports.validateValue = exports.validateTraceabilityForEntry = exports.validateAttributesForEntry = exports.validate = exports.runPipeline = exports.normalizeListValues = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.format = exports.parseSource = exports.parseFile = exports.parse = exports.loadGrammar = exports.isSupportedExtension = exports.detectInlineRefs = exports.detectDirectives = exports.detectCaptions = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.resolveEntryColor = exports.parseManifest = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.readMarkspecYaml = exports.parseMarkspecYaml = exports.MARKSPEC_YAML_FILENAME = exports.parseProjectConfig = exports.loadConfig = exports.discoverProjectRoot = exports.REFHUB_URL = exports.PALETTE_HUES = exports.DEFAULT_PROJECT_CONFIG = exports.ConfigError = exports.VERSION = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @module core
|
|
6
6
|
*
|
|
@@ -16,6 +16,7 @@ exports.VERSION = "0.0.1";
|
|
|
16
16
|
var mod_js_1 = require("./model/mod.js");
|
|
17
17
|
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return mod_js_1.ConfigError; } });
|
|
18
18
|
Object.defineProperty(exports, "DEFAULT_PROJECT_CONFIG", { enumerable: true, get: function () { return mod_js_1.DEFAULT_PROJECT_CONFIG; } });
|
|
19
|
+
Object.defineProperty(exports, "PALETTE_HUES", { enumerable: true, get: function () { return mod_js_1.PALETTE_HUES; } });
|
|
19
20
|
Object.defineProperty(exports, "REFHUB_URL", { enumerable: true, get: function () { return mod_js_1.REFHUB_URL; } });
|
|
20
21
|
// Config
|
|
21
22
|
var mod_js_2 = require("./config/mod.js");
|
|
@@ -37,6 +38,7 @@ Object.defineProperty(exports, "loadChain", { enumerable: true, get: function ()
|
|
|
37
38
|
Object.defineProperty(exports, "loadProfileForCommand", { enumerable: true, get: function () { return mod_js_3.loadProfileForCommand; } });
|
|
38
39
|
Object.defineProperty(exports, "mergeChain", { enumerable: true, get: function () { return mod_js_3.mergeChain; } });
|
|
39
40
|
Object.defineProperty(exports, "parseManifest", { enumerable: true, get: function () { return mod_js_3.parseManifest; } });
|
|
41
|
+
Object.defineProperty(exports, "resolveEntryColor", { enumerable: true, get: function () { return mod_js_3.resolveEntryColor; } });
|
|
40
42
|
Object.defineProperty(exports, "resolveGitSpecifier", { enumerable: true, get: function () { return mod_js_3.resolveGitSpecifier; } });
|
|
41
43
|
Object.defineProperty(exports, "resolveLocalSpecifier", { enumerable: true, get: function () { return mod_js_3.resolveLocalSpecifier; } });
|
|
42
44
|
// Parser
|
package/script/model/mod.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
|
|
7
7
|
export type { AttributeSpec } from "./attributes.js";
|
|
8
|
+
export { COLOR_NAME_RE, PALETTE_HUES } from "./palette.js";
|
|
9
|
+
export type { PaletteHue } from "./palette.js";
|
|
8
10
|
/**
|
|
9
11
|
* Human-readable entry identifier from the `[...]` bracket marker.
|
|
10
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/model/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/model/mod.ts"],"names":[],"mappings":"A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,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/script/model/mod.js
CHANGED
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
* MarkSpec document model — AST types, ID types, and project configuration.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.VALUE_TYPES = exports.LIST_VALUE_TYPES = exports.ConfigError = exports.DEFAULT_PROJECT_CONFIG = exports.REFHUB_URL = exports.URI_SCHEME_RE = exports.ULID_RE = exports.IDENTITY_KEY = exports.UNIVERSAL_ATTRIBUTE_KEYS = exports.attributeSpec = exports.ATTRIBUTE_CATALOG = void 0;
|
|
8
|
+
exports.VALUE_TYPES = exports.LIST_VALUE_TYPES = exports.ConfigError = exports.DEFAULT_PROJECT_CONFIG = exports.REFHUB_URL = exports.URI_SCHEME_RE = exports.ULID_RE = exports.IDENTITY_KEY = exports.PALETTE_HUES = exports.COLOR_NAME_RE = exports.UNIVERSAL_ATTRIBUTE_KEYS = exports.attributeSpec = exports.ATTRIBUTE_CATALOG = void 0;
|
|
9
9
|
exports.shapeFromIdValue = shapeFromIdValue;
|
|
10
10
|
var attributes_js_1 = require("./attributes.js");
|
|
11
11
|
Object.defineProperty(exports, "ATTRIBUTE_CATALOG", { enumerable: true, get: function () { return attributes_js_1.ATTRIBUTE_CATALOG; } });
|
|
12
12
|
Object.defineProperty(exports, "attributeSpec", { enumerable: true, get: function () { return attributes_js_1.attributeSpec; } });
|
|
13
13
|
Object.defineProperty(exports, "UNIVERSAL_ATTRIBUTE_KEYS", { enumerable: true, get: function () { return attributes_js_1.UNIVERSAL_ATTRIBUTE_KEYS; } });
|
|
14
|
+
var palette_js_1 = require("./palette.js");
|
|
15
|
+
Object.defineProperty(exports, "COLOR_NAME_RE", { enumerable: true, get: function () { return palette_js_1.COLOR_NAME_RE; } });
|
|
16
|
+
Object.defineProperty(exports, "PALETTE_HUES", { enumerable: true, get: function () { return palette_js_1.PALETTE_HUES; } });
|
|
14
17
|
/** Core-reserved identity attribute name. */
|
|
15
18
|
exports.IDENTITY_KEY = "Id";
|
|
16
19
|
/** Regex matching a bare ULID (identified-entry `Id:` value). */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module model/palette
|
|
3
|
+
*
|
|
4
|
+
* The seven-hue entry color palette and its semantic-name regex. Single
|
|
5
|
+
* source of truth — both the profile manifest parser and the renderer
|
|
6
|
+
* import from here so the two layers can never drift.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
|
|
9
|
+
* tokens-side change followed by an entry here; the order does not matter
|
|
10
|
+
* but kept stable for diagnostic message readability.
|
|
11
|
+
*/
|
|
12
|
+
/** The seven palette hues a profile may bind a semantic color name to. */
|
|
13
|
+
export declare const PALETTE_HUES: readonly ["blue", "cyan", "teal", "orange", "red", "purple", "grey"];
|
|
14
|
+
/** Type of a palette hue name. */
|
|
15
|
+
export type PaletteHue = typeof PALETTE_HUES[number];
|
|
16
|
+
/** Regex for a valid semantic color-role name (key into `profile.colors:`). */
|
|
17
|
+
export declare const COLOR_NAME_RE: RegExp;
|
|
18
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/model/palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,YAAY,sEAQf,CAAC;AAEX,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAErD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,QAAsB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module model/palette
|
|
4
|
+
*
|
|
5
|
+
* The seven-hue entry color palette and its semantic-name regex. Single
|
|
6
|
+
* source of truth — both the profile manifest parser and the renderer
|
|
7
|
+
* import from here so the two layers can never drift.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
|
|
10
|
+
* tokens-side change followed by an entry here; the order does not matter
|
|
11
|
+
* but kept stable for diagnostic message readability.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.COLOR_NAME_RE = exports.PALETTE_HUES = void 0;
|
|
15
|
+
/** The seven palette hues a profile may bind a semantic color name to. */
|
|
16
|
+
exports.PALETTE_HUES = [
|
|
17
|
+
"blue",
|
|
18
|
+
"cyan",
|
|
19
|
+
"teal",
|
|
20
|
+
"orange",
|
|
21
|
+
"red",
|
|
22
|
+
"purple",
|
|
23
|
+
"grey",
|
|
24
|
+
];
|
|
25
|
+
/** Regex for a valid semantic color-role name (key into `profile.colors:`). */
|
|
26
|
+
exports.COLOR_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* CommonMark + MarkSpec extension parser. Walks the mdast AST to detect
|
|
5
5
|
* `- [DISPLAY_ID] Title` entry blocks and extract structured attributes.
|
|
6
6
|
*/
|
|
7
|
-
import type { Entry } from "../model/mod.js";
|
|
7
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
8
8
|
/** Options for {@linkcode parseMarkdown}. */
|
|
9
9
|
export interface ParseMarkdownOptions {
|
|
10
10
|
/** File path used in source locations. */
|
|
@@ -16,6 +16,13 @@ export interface ParseMarkdownOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
readonly isReferencesDoc?: boolean;
|
|
18
18
|
}
|
|
19
|
+
/** Result returned by {@linkcode parseMarkdown}. */
|
|
20
|
+
export interface ParseMarkdownResult {
|
|
21
|
+
/** Parsed entries found in the Markdown source. */
|
|
22
|
+
readonly entries: Entry[];
|
|
23
|
+
/** Parse-level diagnostics (e.g., deprecation warnings). */
|
|
24
|
+
readonly diagnostics: Diagnostic[];
|
|
25
|
+
}
|
|
19
26
|
/**
|
|
20
27
|
* Parse a Markdown string and return all MarkSpec entries found.
|
|
21
28
|
*
|
|
@@ -26,7 +33,7 @@ export interface ParseMarkdownOptions {
|
|
|
26
33
|
*
|
|
27
34
|
* @param markdown - Markdown source text
|
|
28
35
|
* @param options - Parse options (file path for source locations)
|
|
29
|
-
* @returns
|
|
36
|
+
* @returns Parsed entries and any parse-level diagnostics
|
|
30
37
|
*/
|
|
31
|
-
export declare function parseMarkdown(markdown: string, options?: ParseMarkdownOptions):
|
|
38
|
+
export declare function parseMarkdown(markdown: string, options?: ParseMarkdownOptions): ParseMarkdownResult;
|
|
32
39
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/parser/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAa,KAAK,EAAc,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/parser/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAa,UAAU,EAAE,KAAK,EAAc,MAAM,iBAAiB,CAAC;AAShF,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AA4BD,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC;CACpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,mBAAmB,CAsCrB"}
|
|
@@ -42,13 +42,14 @@ function findIdentityAttribute(attributes) {
|
|
|
42
42
|
*
|
|
43
43
|
* @param markdown - Markdown source text
|
|
44
44
|
* @param options - Parse options (file path for source locations)
|
|
45
|
-
* @returns
|
|
45
|
+
* @returns Parsed entries and any parse-level diagnostics
|
|
46
46
|
*/
|
|
47
47
|
function parseMarkdown(markdown, options) {
|
|
48
48
|
const file = options?.file ?? "<unknown>";
|
|
49
49
|
const isReferencesDoc = detectReferencesDocument(file, options?.isReferencesDoc);
|
|
50
50
|
const tree = remark_js_1.processor.parse(markdown);
|
|
51
51
|
const entries = [];
|
|
52
|
+
const diagnostics = [];
|
|
52
53
|
// Collect link definition identifiers for shortcut reference exclusion.
|
|
53
54
|
const definitions = new Set(tree.children
|
|
54
55
|
.filter((n) => n.type === "definition")
|
|
@@ -61,12 +62,12 @@ function parseMarkdown(markdown, options) {
|
|
|
61
62
|
if (list.ordered)
|
|
62
63
|
continue;
|
|
63
64
|
for (const item of list.children) {
|
|
64
|
-
const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc);
|
|
65
|
+
const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics);
|
|
65
66
|
if (entry)
|
|
66
67
|
entries.push(entry);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
return entries;
|
|
70
|
+
return { entries, diagnostics };
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
73
|
* Detect if a file is a references document.
|
|
@@ -83,8 +84,9 @@ function detectReferencesDocument(file, explicit) {
|
|
|
83
84
|
/**
|
|
84
85
|
* Attempt to extract a MarkSpec entry from a list item.
|
|
85
86
|
* Returns undefined if the list item is not an entry block.
|
|
87
|
+
* Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
|
|
86
88
|
*/
|
|
87
|
-
function extractEntry(item, markdown, file, definitions, isReferencesDoc) {
|
|
89
|
+
function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics) {
|
|
88
90
|
// Task list items (remark-gfm sets checked to true/false) are not entries.
|
|
89
91
|
if (item.checked != null)
|
|
90
92
|
return undefined;
|
|
@@ -145,6 +147,18 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc) {
|
|
|
145
147
|
const bodyContent = extractBodyContent(item, markdown);
|
|
146
148
|
const [body, attrLines] = (0, attributes_js_1.splitBodyAndAttributes)(bodyContent);
|
|
147
149
|
const attributes = (0, attributes_js_1.parseAttributes)(attrLines);
|
|
150
|
+
// Detect legacy paragraph + trailing-backslash attribute form and warn.
|
|
151
|
+
if (attributes.length > 0 &&
|
|
152
|
+
attrLines.some((line) => line.trimEnd().endsWith("\\"))) {
|
|
153
|
+
const entryLine = item.position?.start.line ?? 1;
|
|
154
|
+
diagnostics.push({
|
|
155
|
+
code: "MSL-DEPRECATED-ATTR-001",
|
|
156
|
+
severity: "warning",
|
|
157
|
+
message: "legacy attribute block (paragraph with trailing `\\`) is deprecated; " +
|
|
158
|
+
"run `markspec format` to convert to the canonical indented code block",
|
|
159
|
+
location: { file, line: entryLine, column: 1 },
|
|
160
|
+
});
|
|
161
|
+
}
|
|
148
162
|
// Discriminate shape by the `Id:` attribute's value format.
|
|
149
163
|
let shape;
|
|
150
164
|
let id;
|
package/script/parser/mod.js
CHANGED
|
@@ -40,7 +40,7 @@ Object.defineProperty(exports, "loadGrammar", { enumerable: true, get: function
|
|
|
40
40
|
* @returns Array of parsed entries
|
|
41
41
|
*/
|
|
42
42
|
function parse(markdown, options) {
|
|
43
|
-
return (0, markdown_js_1.parseMarkdown)(markdown, options);
|
|
43
|
+
return (0, markdown_js_1.parseMarkdown)(markdown, options).entries;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Detect if a file is a references document.
|
|
@@ -72,7 +72,7 @@ async function parseFile(content, options) {
|
|
|
72
72
|
const fm = (0, frontmatter_js_1.extractFrontMatter)(content, { file: options.file });
|
|
73
73
|
const body = fm.hadFrontMatter ? fm.markdown : content;
|
|
74
74
|
const isReferencesDoc = isReferencesDocument(options.file);
|
|
75
|
-
const entries = (0, markdown_js_1.parseMarkdown)(body, {
|
|
75
|
+
const { entries, diagnostics: parseDiagnostics } = (0, markdown_js_1.parseMarkdown)(body, {
|
|
76
76
|
file: options.file,
|
|
77
77
|
isReferencesDoc,
|
|
78
78
|
});
|
|
@@ -86,7 +86,7 @@ async function parseFile(content, options) {
|
|
|
86
86
|
return {
|
|
87
87
|
entries,
|
|
88
88
|
document,
|
|
89
|
-
diagnostics: fm.diagnostics,
|
|
89
|
+
diagnostics: [...fm.diagnostics, ...parseDiagnostics],
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
/**
|
package/script/parser/source.js
CHANGED
|
@@ -33,7 +33,7 @@ function parseSource(content, options) {
|
|
|
33
33
|
const entries = [];
|
|
34
34
|
for (const block of blocks) {
|
|
35
35
|
const markdown = wrapAsListItem(block.lines);
|
|
36
|
-
const parsed = (0, markdown_js_1.parseMarkdown)(markdown, { file });
|
|
36
|
+
const { entries: parsed } = (0, markdown_js_1.parseMarkdown)(markdown, { file });
|
|
37
37
|
for (const entry of parsed) {
|
|
38
38
|
const location = {
|
|
39
39
|
file,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/colors
|
|
3
|
+
*
|
|
4
|
+
* Profile-driven entry color resolution. Pure function that maps an entry
|
|
5
|
+
* and the active profile to a palette hue name (or `null` for uncolored).
|
|
6
|
+
*
|
|
7
|
+
* Lives in core/profile so both rendering layers (Typst PDF and HTML book)
|
|
8
|
+
* can call it without crossing the peer-module boundary defined in AGENTS.md.
|
|
9
|
+
*
|
|
10
|
+
* See docs/superpowers/specs/2026-05-06-profile-driven-entry-colors-design.md
|
|
11
|
+
* for the resolution table.
|
|
12
|
+
*/
|
|
13
|
+
import type { EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
|
+
import { type PaletteHue } from "../model/palette.js";
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the palette hue for an entry under the active profile.
|
|
17
|
+
*
|
|
18
|
+
* Returns `null` for referenced-shape entries (uncolored block).
|
|
19
|
+
* Returns a palette hue name for identified entries — using the type's
|
|
20
|
+
* declared color when available, falling back to `"blue"` otherwise.
|
|
21
|
+
*
|
|
22
|
+
* The fallback is the palette hue directly (not the `primary` semantic
|
|
23
|
+
* name) so the renderer works for files compiled without a profile.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveEntryColor(entry: Entry, profile: EffectiveProfile | undefined): PaletteHue | null;
|
|
26
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/profile/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKpE;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,UAAU,GAAG,IAAI,CAmBnB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module core/profile/colors
|
|
4
|
+
*
|
|
5
|
+
* Profile-driven entry color resolution. Pure function that maps an entry
|
|
6
|
+
* and the active profile to a palette hue name (or `null` for uncolored).
|
|
7
|
+
*
|
|
8
|
+
* Lives in core/profile so both rendering layers (Typst PDF and HTML book)
|
|
9
|
+
* can call it without crossing the peer-module boundary defined in AGENTS.md.
|
|
10
|
+
*
|
|
11
|
+
* See docs/superpowers/specs/2026-05-06-profile-driven-entry-colors-design.md
|
|
12
|
+
* for the resolution table.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.resolveEntryColor = resolveEntryColor;
|
|
16
|
+
const palette_js_1 = require("../model/palette.js");
|
|
17
|
+
/** Default identified-entry hue when no profile / no type color resolves. */
|
|
18
|
+
const DEFAULT_HUE = "blue";
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the palette hue for an entry under the active profile.
|
|
21
|
+
*
|
|
22
|
+
* Returns `null` for referenced-shape entries (uncolored block).
|
|
23
|
+
* Returns a palette hue name for identified entries — using the type's
|
|
24
|
+
* declared color when available, falling back to `"blue"` otherwise.
|
|
25
|
+
*
|
|
26
|
+
* The fallback is the palette hue directly (not the `primary` semantic
|
|
27
|
+
* name) so the renderer works for files compiled without a profile.
|
|
28
|
+
*/
|
|
29
|
+
function resolveEntryColor(entry, profile) {
|
|
30
|
+
if (entry.shape === "referenced")
|
|
31
|
+
return null;
|
|
32
|
+
if (!profile || !entry.type)
|
|
33
|
+
return DEFAULT_HUE;
|
|
34
|
+
const typeDef = profile.types.get(entry.type);
|
|
35
|
+
const colorName = typeDef?.value.color.value;
|
|
36
|
+
if (!colorName)
|
|
37
|
+
return DEFAULT_HUE;
|
|
38
|
+
const hueEntry = profile.colors.get(colorName);
|
|
39
|
+
if (!hueEntry)
|
|
40
|
+
return DEFAULT_HUE;
|
|
41
|
+
// Defense in depth: the manifest parser already enforces PALETTE_HUES, but
|
|
42
|
+
// EffectiveProfile can in principle be constructed programmatically (tests,
|
|
43
|
+
// future APIs) without going through parseManifest. Guard the cast so an
|
|
44
|
+
// invalid hue can never reach downstream interpolation.
|
|
45
|
+
const hue = hueEntry.value;
|
|
46
|
+
if (!palette_js_1.PALETTE_HUES.includes(hue))
|
|
47
|
+
return DEFAULT_HUE;
|
|
48
|
+
return hue;
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAyGnE,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AA4tBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CAkNrB"}
|
|
@@ -11,21 +11,6 @@ exports.parseManifest = parseManifest;
|
|
|
11
11
|
const yaml_1 = require("@std/yaml");
|
|
12
12
|
const mod_js_1 = require("../model/mod.js");
|
|
13
13
|
const VALUE_TYPE_SET = new Set(mod_js_1.VALUE_TYPES);
|
|
14
|
-
/**
|
|
15
|
-
* The seven palette hues a profile may bind a semantic name to.
|
|
16
|
-
* Mirrors the `diagram:` group in `theme/tokens.yaml`.
|
|
17
|
-
*/
|
|
18
|
-
const PALETTE_HUES = [
|
|
19
|
-
"blue",
|
|
20
|
-
"cyan",
|
|
21
|
-
"teal",
|
|
22
|
-
"orange",
|
|
23
|
-
"red",
|
|
24
|
-
"purple",
|
|
25
|
-
"grey",
|
|
26
|
-
];
|
|
27
|
-
/** Regex for valid semantic-name keys in `profile.colors:`. */
|
|
28
|
-
const COLOR_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
29
14
|
const ALLOWED_ROOT_KEYS = new Set([
|
|
30
15
|
"id",
|
|
31
16
|
"version",
|
|
@@ -446,9 +431,9 @@ function parseColorsMap(raw, sourcePath, diagnostics) {
|
|
|
446
431
|
return out;
|
|
447
432
|
}
|
|
448
433
|
for (const [name, value] of Object.entries(raw)) {
|
|
449
|
-
if (!COLOR_NAME_RE.test(name)) {
|
|
434
|
+
if (!mod_js_1.COLOR_NAME_RE.test(name)) {
|
|
450
435
|
diagnostics.push({
|
|
451
|
-
code: "PROFILE-
|
|
436
|
+
code: "MSL-PROFILE-COLOR-004",
|
|
452
437
|
severity: "error",
|
|
453
438
|
message: `profile.colors: '${name}' is not a valid semantic name (lowercase letters, digits, hyphens; must start with a letter)`,
|
|
454
439
|
location: { file: sourcePath, line: 1, column: 1 },
|
|
@@ -464,11 +449,11 @@ function parseColorsMap(raw, sourcePath, diagnostics) {
|
|
|
464
449
|
});
|
|
465
450
|
continue;
|
|
466
451
|
}
|
|
467
|
-
if (!PALETTE_HUES.includes(value)) {
|
|
452
|
+
if (!mod_js_1.PALETTE_HUES.includes(value)) {
|
|
468
453
|
diagnostics.push({
|
|
469
454
|
code: "MSL-PROFILE-COLOR-002",
|
|
470
455
|
severity: "error",
|
|
471
|
-
message: `profile.colors.${name}: '${value}' is not a palette hue (allowed: ${PALETTE_HUES.join(", ")})`,
|
|
456
|
+
message: `profile.colors.${name}: '${value}' is not a palette hue (allowed: ${mod_js_1.PALETTE_HUES.join(", ")})`,
|
|
472
457
|
location: { file: sourcePath, line: 1, column: 1 },
|
|
473
458
|
});
|
|
474
459
|
continue;
|
package/script/profile/mod.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export { cacheDir } from "./cache.js";
|
|
|
20
20
|
export type { CacheEnv } from "./cache.js";
|
|
21
21
|
export { defaultRunNpm, resolveNpmSpecifier } from "./npm.js";
|
|
22
22
|
export type { ResolveNpmOptions, RunNpm } from "./npm.js";
|
|
23
|
+
export { resolveEntryColor } from "./colors.js";
|
|
23
24
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
package/script/profile/mod.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* resolution, and merging. Consumed by the validator pipeline and the CLI.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.resolveNpmSpecifier = exports.defaultRunNpm = exports.cacheDir = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
|
|
9
|
+
exports.resolveEntryColor = exports.resolveNpmSpecifier = exports.defaultRunNpm = exports.cacheDir = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
|
|
10
10
|
var manifest_js_1 = require("./manifest.js");
|
|
11
11
|
Object.defineProperty(exports, "parseManifest", { enumerable: true, get: function () { return manifest_js_1.parseManifest; } });
|
|
12
12
|
var resolver_js_1 = require("./resolver.js");
|
|
@@ -29,3 +29,5 @@ Object.defineProperty(exports, "cacheDir", { enumerable: true, get: function ()
|
|
|
29
29
|
var npm_js_1 = require("./npm.js");
|
|
30
30
|
Object.defineProperty(exports, "defaultRunNpm", { enumerable: true, get: function () { return npm_js_1.defaultRunNpm; } });
|
|
31
31
|
Object.defineProperty(exports, "resolveNpmSpecifier", { enumerable: true, get: function () { return npm_js_1.resolveNpmSpecifier; } });
|
|
32
|
+
var colors_js_1 = require("./colors.js");
|
|
33
|
+
Object.defineProperty(exports, "resolveEntryColor", { enumerable: true, get: function () { return colors_js_1.resolveEntryColor; } });
|