patram 0.4.0 → 0.6.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.
@@ -1,158 +1,56 @@
1
- import type {
2
- ClassDefinition,
3
- MappingDefinition,
4
- RelationDefinition,
5
- } from './patram-config.types.ts';
6
-
7
- export interface StoredQueryConfig {
8
- where: string;
9
- }
10
-
1
+ export type StoredQueryConfig =
2
+ import('./load-patram-config.js').StoredQueryConfig;
3
+ export type FieldDisplayConfig =
4
+ import('./load-patram-config.js').FieldDisplayConfig;
5
+ export type FieldQueryConfig =
6
+ import('./load-patram-config.js').FieldQueryConfig;
11
7
  export type FieldValueTypeName =
12
- | 'string'
13
- | 'integer'
14
- | 'enum'
15
- | 'path'
16
- | 'glob'
17
- | 'date'
18
- | 'date_time';
19
-
20
- export interface FieldDisplayConfig {
21
- hidden?: boolean;
22
- order?: number;
23
- }
24
-
25
- export interface FieldQueryConfig {
26
- contains?: boolean;
27
- prefix?: boolean;
28
- }
29
-
30
- export interface StringFieldConfig {
31
- display?: FieldDisplayConfig;
32
- multiple?: boolean;
33
- query?: FieldQueryConfig;
34
- type: 'string';
35
- }
36
-
37
- export interface IntegerFieldConfig {
38
- display?: FieldDisplayConfig;
39
- multiple?: boolean;
40
- type: 'integer';
41
- }
42
-
43
- export interface EnumFieldConfig {
44
- display?: FieldDisplayConfig;
45
- multiple?: boolean;
46
- type: 'enum';
47
- values: string[];
48
- }
49
-
50
- export interface PathFieldConfig {
51
- display?: FieldDisplayConfig;
52
- multiple?: boolean;
53
- path_class?: string;
54
- type: 'path';
55
- }
56
-
57
- export interface GlobFieldConfig {
58
- display?: FieldDisplayConfig;
59
- multiple?: boolean;
60
- type: 'glob';
61
- }
62
-
63
- export interface DateFieldConfig {
64
- display?: FieldDisplayConfig;
65
- multiple?: boolean;
66
- type: 'date';
67
- }
68
-
69
- export interface DateTimeFieldConfig {
70
- display?: FieldDisplayConfig;
71
- multiple?: boolean;
72
- type: 'date_time';
73
- }
74
-
8
+ import('./load-patram-config.js').MetadataFieldConfig['type'];
75
9
  export type MetadataFieldConfig =
76
- | DateFieldConfig
77
- | DateTimeFieldConfig
78
- | EnumFieldConfig
79
- | GlobFieldConfig
80
- | IntegerFieldConfig
81
- | PathFieldConfig
82
- | StringFieldConfig;
83
-
84
- export interface ClassFieldRuleConfig {
85
- presence: 'required' | 'optional' | 'forbidden';
86
- }
87
-
10
+ import('./load-patram-config.js').MetadataFieldConfig;
11
+ export type StringFieldConfig = Extract<
12
+ MetadataFieldConfig,
13
+ { type: 'string' }
14
+ >;
15
+ export type IntegerFieldConfig = Extract<
16
+ MetadataFieldConfig,
17
+ { type: 'integer' }
18
+ >;
19
+ export type EnumFieldConfig = Extract<MetadataFieldConfig, { type: 'enum' }>;
20
+ export type PathFieldConfig = Extract<MetadataFieldConfig, { type: 'path' }>;
21
+ export type GlobFieldConfig = Extract<MetadataFieldConfig, { type: 'glob' }>;
22
+ export type DateFieldConfig = Extract<MetadataFieldConfig, { type: 'date' }>;
23
+ export type DateTimeFieldConfig = Extract<
24
+ MetadataFieldConfig,
25
+ { type: 'date_time' }
26
+ >;
27
+ export type ClassFieldRuleConfig =
28
+ import('./load-patram-config.js').ClassFieldRuleConfig;
88
29
  export type DirectiveTypeConfig = MetadataFieldConfig;
89
30
  export type MetadataDirectiveRuleConfig = ClassFieldRuleConfig;
90
-
91
- export interface ClassSchemaConfig {
92
- document_path_class?: string;
93
- fields: Record<string, ClassFieldRuleConfig>;
94
- unknown_fields?: 'ignore' | 'error';
95
- }
96
-
31
+ export type ClassSchemaConfig =
32
+ import('./load-patram-config.js').ClassSchemaConfig;
97
33
  export type MetadataSchemaConfig = ClassSchemaConfig;
98
-
99
- export interface PathClassConfig {
100
- prefixes: string[];
101
- }
102
-
103
- export type DerivedSummaryScalar = boolean | number | string | null;
104
-
105
- export interface DerivedSummaryCountFieldConfig {
106
- count: {
107
- traversal: string;
108
- where: string;
109
- };
110
- name: string;
111
- }
112
-
113
- export interface DerivedSummarySelectCaseConfig {
114
- value: DerivedSummaryScalar;
115
- when: string;
116
- }
117
-
118
- export interface DerivedSummarySelectFieldConfig {
119
- default: DerivedSummaryScalar;
120
- name: string;
121
- select: DerivedSummarySelectCaseConfig[];
122
- }
123
-
34
+ export type PathClassConfig = import('./load-patram-config.js').PathClassConfig;
35
+ export type DerivedSummaryScalar =
36
+ import('./load-patram-config.js').DerivedSummaryScalar;
37
+ export type DerivedSummarySelectCaseConfig =
38
+ import('./load-patram-config.js').DerivedSummarySelectCaseConfig;
124
39
  export type DerivedSummaryFieldConfig =
125
- | DerivedSummaryCountFieldConfig
126
- | DerivedSummarySelectFieldConfig;
127
-
128
- export interface DerivedSummaryConfig {
129
- classes: string[];
130
- fields: DerivedSummaryFieldConfig[];
131
- }
132
-
133
- export interface PatramRepoConfig {
134
- class_schemas?: Record<string, ClassSchemaConfig>;
135
- classes?: Record<string, ClassDefinition>;
136
- derived_summaries?: Record<string, DerivedSummaryConfig>;
137
- fields?: Record<string, MetadataFieldConfig>;
138
- include: string[];
139
- mappings?: Record<string, MappingDefinition>;
140
- path_classes?: Record<string, PathClassConfig>;
141
- queries: Record<string, StoredQueryConfig>;
142
- relations?: Record<string, RelationDefinition>;
143
- }
144
-
145
- export interface PatramDiagnostic {
146
- code: string;
147
- column: number;
148
- level: 'error';
149
- line: number;
150
- message: string;
151
- path: string;
152
- }
153
-
154
- export interface LoadPatramConfigResult {
155
- config: PatramRepoConfig | null;
156
- config_path: string;
157
- diagnostics: PatramDiagnostic[];
158
- }
40
+ import('./load-patram-config.js').DerivedSummaryFieldConfig;
41
+ export type DerivedSummaryCountFieldConfig = Extract<
42
+ DerivedSummaryFieldConfig,
43
+ { count: unknown }
44
+ >;
45
+ export type DerivedSummarySelectFieldConfig = Extract<
46
+ DerivedSummaryFieldConfig,
47
+ { select: unknown }
48
+ >;
49
+ export type DerivedSummaryConfig =
50
+ import('./load-patram-config.js').DerivedSummaryConfig;
51
+ export type PatramRepoConfig =
52
+ import('./load-patram-config.js').PatramRepoConfig;
53
+ export type PatramDiagnostic =
54
+ import('./load-patram-config.js').PatramDiagnostic;
55
+ export type LoadPatramConfigResult =
56
+ import('./load-patram-config.js').LoadPatramConfigResult;
@@ -10,7 +10,7 @@ import { resolve } from 'node:path';
10
10
  import { buildGraph } from './build-graph.js';
11
11
  import { listSourceFiles } from './list-source-files.js';
12
12
  import { loadPatramConfig } from './load-patram-config.js';
13
- import { parseSourceFile } from './parse-claims.js';
13
+ import { createParseOptions, parseSourceFile } from './parse-claims.js';
14
14
  import { resolvePatramGraphConfig } from './resolve-patram-graph-config.js';
15
15
 
16
16
  /**
@@ -68,6 +68,7 @@ export async function loadProjectGraph(project_directory) {
68
68
  project_directory,
69
69
  );
70
70
  const collect_result = await collectClaims(
71
+ repo_config,
71
72
  source_file_paths,
72
73
  project_directory,
73
74
  );
@@ -96,25 +97,34 @@ export async function loadProjectGraph(project_directory) {
96
97
  }
97
98
 
98
99
  /**
100
+ * @param {PatramRepoConfig} repo_config
99
101
  * @param {string[]} source_file_paths
100
102
  * @param {string} project_directory
101
103
  * @returns {Promise<{ claims: PatramClaim[], diagnostics: PatramDiagnostic[] }>}
102
104
  */
103
- async function collectClaims(source_file_paths, project_directory) {
105
+ async function collectClaims(
106
+ repo_config,
107
+ source_file_paths,
108
+ project_directory,
109
+ ) {
104
110
  /** @type {PatramClaim[]} */
105
111
  const claims = [];
106
112
  /** @type {PatramDiagnostic[]} */
107
113
  const diagnostics = [];
114
+ const parse_options = createParseOptions(repo_config);
108
115
 
109
116
  for (const source_file_path of source_file_paths) {
110
117
  const source_text = await readFile(
111
118
  resolve(project_directory, source_file_path),
112
119
  'utf8',
113
120
  );
114
- const parse_result = parseSourceFile({
115
- path: source_file_path,
116
- source: source_text,
117
- });
121
+ const parse_result = parseSourceFile(
122
+ {
123
+ path: source_file_path,
124
+ source: source_text,
125
+ },
126
+ parse_options,
127
+ );
118
128
 
119
129
  claims.push(...parse_result.claims);
120
130
  diagnostics.push(...parse_result.diagnostics);
@@ -1,12 +1,15 @@
1
- /** @import * as $k$$l$parse$j$claims$k$types$k$ts from './parse-claims.types.ts'; */
2
1
  /**
3
- * @import { ParseClaimsInput, ParseSourceFileResult } from './parse-claims.types.ts';
2
+ * @import { ParseClaimsInput, ParseSourceFileResult, PatramClaim } from './parse-claims.types.ts';
4
3
  */
5
4
 
6
5
  import { getFileExtension } from './claim-helpers.js';
7
6
  import { parseJsdocClaims } from './parse-jsdoc-claims.js';
8
7
  import { parseMarkdownClaims } from './parse-markdown-claims.js';
9
- import { MARKDOWN_SOURCE_FILE_EXTENSIONS } from './source-file-defaults.js';
8
+ import { parseYamlClaims } from './parse-yaml-claims.js';
9
+ import {
10
+ MARKDOWN_SOURCE_FILE_EXTENSIONS,
11
+ YAML_SOURCE_FILE_EXTENSIONS,
12
+ } from './source-file-defaults.js';
10
13
 
11
14
  /**
12
15
  * Source claim dispatch.
@@ -27,21 +30,24 @@ import { MARKDOWN_SOURCE_FILE_EXTENSIONS } from './source-file-defaults.js';
27
30
  */
28
31
 
29
32
  const MARKDOWN_EXTENSIONS = new Set(MARKDOWN_SOURCE_FILE_EXTENSIONS);
33
+ const YAML_EXTENSIONS = new Set(YAML_SOURCE_FILE_EXTENSIONS);
30
34
 
31
35
  /**
32
36
  * Parse one source file into claims and diagnostics.
33
37
  *
34
38
  * @param {ParseClaimsInput} parse_input
39
+ * @param {{ multi_value_directive_names?: ReadonlySet<string> }} [parse_options]
35
40
  * @returns {ParseSourceFileResult}
36
41
  */
37
- export function parseSourceFile(parse_input) {
42
+ export function parseSourceFile(parse_input, parse_options) {
38
43
  const file_extension = getFileExtension(parse_input.path);
39
44
 
40
45
  if (MARKDOWN_EXTENSIONS.has(file_extension)) {
41
- return {
42
- claims: parseMarkdownClaims(parse_input),
43
- diagnostics: [],
44
- };
46
+ return parseMarkdownClaims(parse_input, parse_options);
47
+ }
48
+
49
+ if (YAML_EXTENSIONS.has(file_extension)) {
50
+ return parseYamlClaims(parse_input, parse_options);
45
51
  }
46
52
 
47
53
  return parseJsdocClaims(parse_input);
@@ -51,8 +57,88 @@ export function parseSourceFile(parse_input) {
51
57
  * Parse a file into neutral Patram claims.
52
58
  *
53
59
  * @param {ParseClaimsInput} parse_input
54
- * @returns {$k$$l$parse$j$claims$k$types$k$ts.PatramClaim[]}
60
+ * @param {{ multi_value_directive_names?: ReadonlySet<string> }} [parse_options]
61
+ * @returns {PatramClaim[]}
62
+ */
63
+ export function parseClaims(parse_input, parse_options) {
64
+ return parseSourceFile(parse_input, parse_options).claims;
65
+ }
66
+
67
+ /**
68
+ * Build parser options from repo config.
69
+ *
70
+ * @param {{ fields?: Record<string, { multiple?: boolean }>, mappings?: Record<string, { emit?: unknown, node?: unknown }> } | undefined} repo_config
71
+ * @returns {{ multi_value_directive_names: Set<string> }}
72
+ */
73
+ export function createParseOptions(repo_config) {
74
+ return {
75
+ multi_value_directive_names: collectMultiValueDirectiveNames(repo_config),
76
+ };
77
+ }
78
+
79
+ /**
80
+ * @param {{ fields?: Record<string, { multiple?: boolean }>, mappings?: Record<string, { emit?: unknown, node?: unknown }> } | undefined} repo_config
81
+ * @returns {Set<string>}
55
82
  */
56
- export function parseClaims(parse_input) {
57
- return parseSourceFile(parse_input).claims;
83
+ function collectMultiValueDirectiveNames(repo_config) {
84
+ /** @type {Set<string>} */
85
+ const multi_value_directive_names = new Set();
86
+
87
+ collectMultipleFieldNames(repo_config?.fields, multi_value_directive_names);
88
+ collectEmitOnlyDirectiveNames(
89
+ repo_config?.mappings,
90
+ multi_value_directive_names,
91
+ );
92
+
93
+ return multi_value_directive_names;
94
+ }
95
+
96
+ /**
97
+ * @param {Record<string, { multiple?: boolean }> | undefined} fields
98
+ * @param {Set<string>} multi_value_directive_names
99
+ */
100
+ function collectMultipleFieldNames(fields, multi_value_directive_names) {
101
+ for (const [field_name, field_definition] of Object.entries(fields ?? {})) {
102
+ if (field_definition.multiple === true) {
103
+ multi_value_directive_names.add(field_name);
104
+ }
105
+ }
106
+ }
107
+
108
+ /**
109
+ * @param {Record<string, { emit?: unknown, node?: unknown }> | undefined} mappings
110
+ * @param {Set<string>} multi_value_directive_names
111
+ */
112
+ function collectEmitOnlyDirectiveNames(mappings, multi_value_directive_names) {
113
+ for (const [mapping_name, mapping_definition] of Object.entries(
114
+ mappings ?? {},
115
+ )) {
116
+ const directive_name = resolveEmitOnlyDirectiveName(
117
+ mapping_name,
118
+ mapping_definition,
119
+ );
120
+
121
+ if (directive_name) {
122
+ multi_value_directive_names.add(directive_name);
123
+ }
124
+ }
125
+ }
126
+
127
+ /**
128
+ * @param {string} mapping_name
129
+ * @param {{ emit?: unknown, node?: unknown }} mapping_definition
130
+ * @returns {string | null}
131
+ */
132
+ function resolveEmitOnlyDirectiveName(mapping_name, mapping_definition) {
133
+ const directive_match = mapping_name.match(/^[^.]+\.directive\.(.+)$/du);
134
+
135
+ if (
136
+ !directive_match ||
137
+ mapping_definition.emit === undefined ||
138
+ mapping_definition.node !== undefined
139
+ ) {
140
+ return null;
141
+ }
142
+
143
+ return directive_match[1];
58
144
  }
@@ -1,5 +1,11 @@
1
1
  import type { PatramDiagnostic } from './load-patram-config.types.ts';
2
2
 
3
+ export type MarkdownDirectiveStyle =
4
+ | 'front_matter'
5
+ | 'visible_line'
6
+ | 'list_item'
7
+ | 'hidden_tag';
8
+
3
9
  export interface ParseClaimsInput {
4
10
  path: string;
5
11
  source: string;
@@ -14,6 +20,7 @@ export interface ClaimOrigin {
14
20
  export interface PatramClaim {
15
21
  document_id: string;
16
22
  id: string;
23
+ markdown_style?: MarkdownDirectiveStyle;
17
24
  name?: string;
18
25
  origin: ClaimOrigin;
19
26
  parser?: string;
@@ -1,6 +1,6 @@
1
- /** @import * as $k$$l$load$j$patram$j$config$k$types$k$ts from './load-patram-config.types.ts'; */
2
1
  /**
3
- * @import { ParseClaimsInput, ParseSourceFileResult, PatramClaim, PatramClaimFields } from './parse-claims.types.ts';
2
+ * @import { PatramDiagnostic } from './load-patram-config.types.ts';
3
+ * @import { ParseClaimsInput, ParseSourceFileResult, PatramClaimFields } from './parse-claims.types.ts';
4
4
  */
5
5
 
6
6
  import {
@@ -266,7 +266,7 @@ function compareClaimEntries(left_entry, right_entry) {
266
266
  /**
267
267
  * @param {string} file_path
268
268
  * @param {{ activation_column: number | null, activation_line: number | null }} jsdoc_block
269
- * @returns {$k$$l$load$j$patram$j$config$k$types$k$ts.PatramDiagnostic}
269
+ * @returns {PatramDiagnostic}
270
270
  */
271
271
  function createMultiplePatramBlocksDiagnostic(file_path, jsdoc_block) {
272
272
  return {
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * @import { PatramClaim, ParseClaimsInput, PatramClaimFields } from './parse-claims.types.ts';
3
+ * @import { PatramDiagnostic } from './load-patram-config.types.ts';
3
4
  */
4
5
 
5
6
  import { createClaim, isPathLikeTarget } from './claim-helpers.js';
@@ -31,9 +32,10 @@ const MARKDOWN_LINK_PATTERN = /\[([^\]]+)\]\(([^)]+)\)/dgu;
31
32
 
32
33
  /**
33
34
  * @param {ParseClaimsInput} parse_input
34
- * @returns {PatramClaim[]}
35
+ * @param {{ multi_value_directive_names?: ReadonlySet<string> }} [parse_options]
36
+ * @returns {{ claims: PatramClaim[], diagnostics: PatramDiagnostic[] }}
35
37
  */
36
- export function parseMarkdownClaims(parse_input) {
38
+ export function parseMarkdownClaims(parse_input, parse_options) {
37
39
  const lines = parse_input.source.split('\n');
38
40
 
39
41
  /** @type {PatramClaim[]} */
@@ -41,6 +43,7 @@ export function parseMarkdownClaims(parse_input) {
41
43
  const front_matter_result = parseFrontMatterDirectiveFields(
42
44
  parse_input.path,
43
45
  lines,
46
+ parse_options,
44
47
  );
45
48
  /** @type {{ character: string, length: number } | null} */
46
49
  let open_fence = null;
@@ -93,7 +96,10 @@ export function parseMarkdownClaims(parse_input) {
93
96
  collectHiddenDirectiveClaims(parse_input.path, line, line_number, claims);
94
97
  }
95
98
 
96
- return claims;
99
+ return {
100
+ claims,
101
+ diagnostics: front_matter_result.diagnostics,
102
+ };
97
103
  }
98
104
 
99
105
  /**
@@ -1,22 +1,31 @@
1
1
  /**
2
- * @import { PatramClaimFields } from './parse-claims.types.ts';
2
+ * @import { MarkdownDirectiveStyle, PatramClaimFields } from './parse-claims.types.ts';
3
+ * @import { PatramDiagnostic } from './load-patram-config.types.ts';
3
4
  */
4
5
 
6
+ import { parseYamlDirectiveFields } from './parse-yaml-claims.js';
7
+
5
8
  const FRONT_MATTER_BOUNDARY_PATTERN = /^---$/du;
6
- const FRONT_MATTER_DIRECTIVE_PATTERN = /^([A-Za-z][A-Za-z0-9 _-]*):\s+(.+)$/du;
7
9
  const MARKDOWN_HIDDEN_DIRECTIVE_PATTERN =
8
10
  /^\[patram\s+([A-Za-z][A-Za-z0-9 _-]*)=(.+)\]:\s*#\s*$/du;
9
- const VISIBLE_DIRECTIVE_PATTERN = /^(?:-\s+)?([A-Z][A-Za-z _-]*):\s+(.+)$/du;
11
+ const LIST_ITEM_DIRECTIVE_PATTERN = /^-\s+([A-Z][A-Za-z _-]*):\s+(.+)$/du;
12
+ const VISIBLE_DIRECTIVE_PATTERN = /^([A-Z][A-Za-z _-]*):\s+(.+)$/du;
10
13
 
11
14
  /**
12
15
  * @param {string} file_path
13
16
  * @param {string[]} lines
14
- * @returns {{ body_start: number, directive_fields: PatramClaimFields[] }}
17
+ * @param {{ multi_value_directive_names?: ReadonlySet<string> }} [parse_options]
18
+ * @returns {{ body_start: number, diagnostics: PatramDiagnostic[], directive_fields: PatramClaimFields[] }}
15
19
  */
16
- export function parseFrontMatterDirectiveFields(file_path, lines) {
20
+ export function parseFrontMatterDirectiveFields(
21
+ file_path,
22
+ lines,
23
+ parse_options,
24
+ ) {
17
25
  if (lines[0] !== '---') {
18
26
  return {
19
27
  body_start: 0,
28
+ diagnostics: [],
20
29
  directive_fields: [],
21
30
  };
22
31
  }
@@ -26,31 +35,23 @@ export function parseFrontMatterDirectiveFields(file_path, lines) {
26
35
  if (closing_line_index < 0) {
27
36
  return {
28
37
  body_start: 0,
38
+ diagnostics: [],
29
39
  directive_fields: [],
30
40
  };
31
41
  }
32
-
33
- /** @type {PatramClaimFields[]} */
34
- const directive_fields = [];
35
-
36
- for (let line_index = 1; line_index < closing_line_index; line_index += 1) {
37
- const directive_fields_match = matchDirectiveFields(
38
- FRONT_MATTER_DIRECTIVE_PATTERN,
39
- file_path,
40
- lines[line_index],
41
- line_index + 1,
42
- );
43
-
44
- if (!directive_fields_match) {
45
- continue;
46
- }
47
-
48
- directive_fields.push(directive_fields_match);
49
- }
42
+ const parse_result = parseYamlDirectiveFields({
43
+ file_path,
44
+ markdown_style: 'front_matter',
45
+ multi_value_directive_names: parse_options?.multi_value_directive_names,
46
+ parser: 'markdown',
47
+ source_text: lines.slice(1, closing_line_index).join('\n'),
48
+ start_line: 2,
49
+ });
50
50
 
51
51
  return {
52
52
  body_start: closing_line_index + 1,
53
- directive_fields,
53
+ diagnostics: parse_result.diagnostics,
54
+ directive_fields: parse_result.directive_fields,
54
55
  };
55
56
  }
56
57
 
@@ -61,8 +62,21 @@ export function parseFrontMatterDirectiveFields(file_path, lines) {
61
62
  * @returns {PatramClaimFields | null}
62
63
  */
63
64
  export function matchVisibleDirectiveFields(file_path, line, line_number) {
65
+ const list_item_match = matchDirectiveFields(
66
+ LIST_ITEM_DIRECTIVE_PATTERN,
67
+ 'list_item',
68
+ file_path,
69
+ line,
70
+ line_number,
71
+ );
72
+
73
+ if (list_item_match) {
74
+ return list_item_match;
75
+ }
76
+
64
77
  return matchDirectiveFields(
65
78
  VISIBLE_DIRECTIVE_PATTERN,
79
+ 'visible_line',
66
80
  file_path,
67
81
  line,
68
82
  line_number,
@@ -78,6 +92,7 @@ export function matchVisibleDirectiveFields(file_path, line, line_number) {
78
92
  export function matchHiddenDirectiveFields(file_path, line, line_number) {
79
93
  return matchDirectiveFields(
80
94
  MARKDOWN_HIDDEN_DIRECTIVE_PATTERN,
95
+ 'hidden_tag',
81
96
  file_path,
82
97
  line,
83
98
  line_number,
@@ -100,12 +115,19 @@ function findFrontMatterClosingLineIndex(lines) {
100
115
 
101
116
  /**
102
117
  * @param {RegExp} pattern
118
+ * @param {MarkdownDirectiveStyle} markdown_style
103
119
  * @param {string} file_path
104
120
  * @param {string} line
105
121
  * @param {number} line_number
106
122
  * @returns {PatramClaimFields | null}
107
123
  */
108
- function matchDirectiveFields(pattern, file_path, line, line_number) {
124
+ function matchDirectiveFields(
125
+ pattern,
126
+ markdown_style,
127
+ file_path,
128
+ line,
129
+ line_number,
130
+ ) {
109
131
  const directive_match = line.match(pattern);
110
132
 
111
133
  if (!directive_match) {
@@ -113,6 +135,7 @@ function matchDirectiveFields(pattern, file_path, line, line_number) {
113
135
  }
114
136
 
115
137
  return {
138
+ markdown_style,
116
139
  name: normalizeDirectiveName(directive_match[1]),
117
140
  origin: {
118
141
  column: 1,