@fuzdev/fuz_ui 0.190.0 → 0.191.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.
Files changed (72) hide show
  1. package/dist/ContextmenuRootForSafariCompatibility.svelte +1 -1
  2. package/dist/MdzNodeView.svelte +3 -2
  3. package/dist/MdzNodeView.svelte.d.ts +1 -1
  4. package/dist/MdzNodeView.svelte.d.ts.map +1 -1
  5. package/dist/analysis_context.d.ts +2 -2
  6. package/dist/analysis_context.js +2 -2
  7. package/dist/contextmenu_state.svelte.d.ts +7 -7
  8. package/dist/contextmenu_state.svelte.js +7 -7
  9. package/dist/docs_helpers.svelte.d.ts +7 -5
  10. package/dist/docs_helpers.svelte.d.ts.map +1 -1
  11. package/dist/docs_helpers.svelte.js +7 -5
  12. package/dist/intersect.svelte.d.ts +1 -1
  13. package/dist/intersect.svelte.js +1 -1
  14. package/dist/library_analysis.d.ts +5 -5
  15. package/dist/library_analysis.js +5 -5
  16. package/dist/library_gen.d.ts +4 -4
  17. package/dist/library_gen.js +4 -4
  18. package/dist/library_generate.d.ts +2 -2
  19. package/dist/library_helpers.d.ts +8 -8
  20. package/dist/library_helpers.js +8 -8
  21. package/dist/library_pipeline.d.ts +5 -5
  22. package/dist/library_pipeline.js +5 -5
  23. package/dist/mdz.d.ts +1 -14
  24. package/dist/mdz.d.ts.map +1 -1
  25. package/dist/mdz.js +57 -156
  26. package/dist/mdz_helpers.d.ts +26 -2
  27. package/dist/mdz_helpers.d.ts.map +1 -1
  28. package/dist/mdz_helpers.js +59 -5
  29. package/dist/mdz_lexer.d.ts.map +1 -1
  30. package/dist/mdz_lexer.js +18 -9
  31. package/dist/mdz_to_svelte.d.ts +5 -5
  32. package/dist/mdz_to_svelte.d.ts.map +1 -1
  33. package/dist/mdz_to_svelte.js +5 -5
  34. package/dist/mdz_token_parser.js +4 -3
  35. package/dist/module_helpers.d.ts +8 -8
  36. package/dist/module_helpers.js +8 -8
  37. package/dist/package_helpers.d.ts +12 -12
  38. package/dist/package_helpers.js +12 -12
  39. package/dist/storage.d.ts +3 -3
  40. package/dist/storage.js +3 -3
  41. package/dist/svelte_helpers.d.ts +9 -9
  42. package/dist/svelte_helpers.js +9 -9
  43. package/dist/svelte_preprocess_mdz.d.ts +1 -1
  44. package/dist/svelte_preprocess_mdz.js +1 -1
  45. package/dist/ts_helpers.d.ts +19 -19
  46. package/dist/ts_helpers.js +19 -19
  47. package/dist/tsdoc_helpers.d.ts +5 -5
  48. package/dist/tsdoc_helpers.js +5 -5
  49. package/dist/tsdoc_mdz.js +1 -1
  50. package/package.json +4 -3
  51. package/src/lib/analysis_context.ts +2 -2
  52. package/src/lib/contextmenu_state.svelte.ts +7 -7
  53. package/src/lib/docs_helpers.svelte.ts +7 -5
  54. package/src/lib/intersect.svelte.ts +1 -1
  55. package/src/lib/library_analysis.ts +5 -5
  56. package/src/lib/library_gen.ts +4 -4
  57. package/src/lib/library_generate.ts +2 -2
  58. package/src/lib/library_helpers.ts +8 -8
  59. package/src/lib/library_pipeline.ts +5 -5
  60. package/src/lib/mdz.ts +63 -167
  61. package/src/lib/mdz_helpers.ts +60 -5
  62. package/src/lib/mdz_lexer.ts +20 -9
  63. package/src/lib/mdz_to_svelte.ts +6 -5
  64. package/src/lib/mdz_token_parser.ts +4 -3
  65. package/src/lib/module_helpers.ts +8 -8
  66. package/src/lib/package_helpers.ts +12 -12
  67. package/src/lib/storage.ts +3 -3
  68. package/src/lib/svelte_helpers.ts +9 -9
  69. package/src/lib/svelte_preprocess_mdz.ts +1 -1
  70. package/src/lib/ts_helpers.ts +19 -19
  71. package/src/lib/tsdoc_helpers.ts +5 -5
  72. package/src/lib/tsdoc_mdz.ts +1 -1
@@ -7,8 +7,8 @@
7
7
  * @module
8
8
  */
9
9
 
10
- import {mdz_is_url} from './mdz.js';
11
10
  import {
11
+ mdz_is_url,
12
12
  is_letter,
13
13
  is_tag_name_char,
14
14
  is_word_char,
@@ -276,14 +276,17 @@ export class MdzLexer {
276
276
  end: this.#index, // end of "## " prefix
277
277
  });
278
278
 
279
+ // Find end-of-line to bound nested tokenizers (prevents tag scanner from scanning past heading)
280
+ let eol = this.#text.indexOf('\n', this.#index);
281
+ if (eol === -1) eol = this.#text.length;
282
+
283
+ const saved_max = this.#max_search_index;
284
+ this.#max_search_index = eol;
285
+
279
286
  // Tokenize inline content until newline or EOF
280
287
  // tokenize_text may consume a newline as part of block-element lookahead,
281
288
  // so we check emitted text tokens for embedded newlines and trim.
282
- while (this.#index < this.#text.length) {
283
- if (this.#text.charCodeAt(this.#index) === NEWLINE) {
284
- break;
285
- }
286
-
289
+ while (this.#index < eol) {
287
290
  const token_count_before = this.#tokens.length;
288
291
  this.#tokenize_inline();
289
292
 
@@ -307,6 +310,8 @@ export class MdzLexer {
307
310
  }
308
311
  }
309
312
 
313
+ this.#max_search_index = saved_max;
314
+
310
315
  // Emit heading_end marker so the token parser knows where heading content stops
311
316
  this.#tokens.push({type: 'heading_end', start: this.#index, end: this.#index});
312
317
 
@@ -798,11 +803,17 @@ export class MdzLexer {
798
803
  }
799
804
  this.#index++; // consume >
800
805
 
801
- // Check for closing tag existence before committing
806
+ // Check for closing tag existence before committing
807
+ // must exist within search boundary and before any paragraph break
802
808
  const closing_tag = `</${tag_name}>`;
809
+ const search_limit = Math.min(this.#max_search_index, this.#text.length);
803
810
  const closing_tag_pos = this.#text.indexOf(closing_tag, this.#index);
804
- if (closing_tag_pos === -1) {
805
- // No closing tag - revert
811
+ if (closing_tag_pos === -1 || closing_tag_pos >= search_limit) {
812
+ this.#index = start + 1;
813
+ this.#emit_text('<', start);
814
+ return;
815
+ }
816
+ if (this.#has_paragraph_break_between(this.#index, closing_tag_pos)) {
806
817
  this.#index = start + 1;
807
818
  this.#emit_text('<', start);
808
819
  return;
@@ -12,7 +12,8 @@ import {UnreachableError} from '@fuzdev/fuz_util/error.js';
12
12
  import {escape_svelte_text} from '@fuzdev/fuz_util/svelte_preprocess_helpers.js';
13
13
  import {escape_js_string} from '@fuzdev/fuz_util/string.js';
14
14
 
15
- import {type MdzNode, resolve_relative_path} from './mdz.js';
15
+ import type {MdzNode} from './mdz.js';
16
+ import {resolve_relative_path} from './mdz_helpers.js';
16
17
 
17
18
  /**
18
19
  * Result of converting `MdzNode` arrays to Svelte markup.
@@ -34,12 +35,12 @@ export interface MdzToSvelteResult {
34
35
  * Each node type produces output matching what `MdzNodeView.svelte` renders at runtime.
35
36
  * Collects required imports and flags unconfigured component/element references.
36
37
  *
37
- * @param nodes Parsed mdz nodes to render.
38
- * @param components Component name to import path mapping (e.g., `{Alert: '$lib/Alert.svelte'}`).
38
+ * @param nodes - parsed mdz nodes to render.
39
+ * @param components - component name to import path mapping (e.g., `{Alert: '$lib/Alert.svelte'}`).
39
40
  * If content references a component not in this map, `has_unconfigured_tags` is set.
40
- * @param elements Allowed HTML element names (e.g., `new Set(['aside', 'details'])`).
41
+ * @param elements - allowed HTML element names (e.g., `new Set(['aside', 'details'])`).
41
42
  * If content references an element not in this set, `has_unconfigured_tags` is set.
42
- * @param base Base path for resolving relative links (e.g., `'/docs/mdz/'`).
43
+ * @param base - base path for resolving relative links (e.g., `'/docs/mdz/'`).
43
44
  * When provided, relative references (`./`, `../`) are resolved to absolute paths
44
45
  * and passed through `resolve()`. Trailing slash recommended.
45
46
  */
@@ -18,7 +18,7 @@ import type {
18
18
  MdzElementNode,
19
19
  MdzComponentNode,
20
20
  } from './mdz.js';
21
- import {extract_single_tag} from './mdz_helpers.js';
21
+ import {extract_single_tag, mdz_heading_id} from './mdz_helpers.js';
22
22
  import {
23
23
  MdzLexer,
24
24
  type MdzToken,
@@ -124,9 +124,10 @@ class MdzTokenParser {
124
124
  if (node) children.push(node);
125
125
  }
126
126
 
127
- const end = children.length > 0 ? children[children.length - 1]!.end : start + level + 1;
127
+ const merged = this.#merge_adjacent_text(children);
128
+ const end = merged.length > 0 ? merged[merged.length - 1]!.end : start + level + 1;
128
129
 
129
- return {type: 'Heading', level, children, start, end};
130
+ return {type: 'Heading', level, id: mdz_heading_id(merged), children: merged, start, end};
130
131
  }
131
132
 
132
133
  #parse_inline(): MdzNode | null {
@@ -174,8 +174,8 @@ export const MODULE_SOURCE_PARTIAL: ModuleSourcePartial = {
174
174
  /**
175
175
  * Create complete source options from project root and optional overrides.
176
176
  *
177
- * @param project_root Absolute path to project root (typically `process.cwd()`)
178
- * @param overrides Optional overrides for default options
177
+ * @param project_root - absolute path to project root (typically `process.cwd()`)
178
+ * @param overrides - optional overrides for default options
179
179
  *
180
180
  * @example
181
181
  * ```ts
@@ -348,8 +348,8 @@ export const module_get_source_root = (options: ModuleSourceOptions): string =>
348
348
  *
349
349
  * Uses proper path semantics: strips `project_root/source_root/` prefix.
350
350
  *
351
- * @param source_id Absolute path to the source file
352
- * @param options Module source options for path extraction
351
+ * @param source_id - absolute path to the source file
352
+ * @param options - module source options for path extraction
353
353
  *
354
354
  * @example
355
355
  * ```ts
@@ -430,8 +430,8 @@ export const module_is_test = (path: string): boolean => path.endsWith('.test.ts
430
430
  * `project_root/source_path/`. No heuristics needed - nested directories
431
431
  * are correctly excluded by the prefix check.
432
432
  *
433
- * @param path Full absolute path to check
434
- * @param options Module source options for filtering
433
+ * @param path - full absolute path to check
434
+ * @param options - module source options for filtering
435
435
  * @returns True if the path is an analyzable source file
436
436
  *
437
437
  * @example
@@ -465,8 +465,8 @@ export const module_is_source = (path: string, options: ModuleSourceOptions): bo
465
465
  * Filters to only include source modules (excludes external packages, node_modules, tests).
466
466
  * Returns sorted arrays of module paths (relative to source_root) for deterministic output.
467
467
  *
468
- * @param source_file The source file info to extract dependencies from
469
- * @param options Module source options for filtering and path extraction
468
+ * @param source_file - the source file info to extract dependencies from
469
+ * @param options - module source options for filtering and path extraction
470
470
  */
471
471
  export const module_extract_dependencies = (
472
472
  source_file: SourceFileInfo,
@@ -27,9 +27,9 @@ import type {PackageJson} from '@fuzdev/fuz_util/package_json.js';
27
27
  /**
28
28
  * Build GitHub file URL for a repository.
29
29
  *
30
- * @param repo_url Repository URL (e.g., 'https://github.com/owner/repo')
31
- * @param file_path Path to the file (leading './' is stripped)
32
- * @param line Optional line number for deep linking
30
+ * @param repo_url - repository URL (e.g., 'https://github.com/owner/repo')
31
+ * @param file_path - path to the file (leading './' is stripped)
32
+ * @param line - optional line number for deep linking
33
33
  * @returns Full GitHub URL to the file on the main branch
34
34
  *
35
35
  * @example
@@ -53,8 +53,8 @@ export const url_github_file = (repo_url: string, file_path: string, line?: numb
53
53
  /**
54
54
  * Build GitHub organization URL from repo URL and repo name.
55
55
  *
56
- * @param repo_url Repository URL (e.g., 'https://github.com/owner/repo')
57
- * @param repo_name Repository name to strip from the URL
56
+ * @param repo_url - repository URL (e.g., 'https://github.com/owner/repo')
57
+ * @param repo_name - repository name to strip from the URL
58
58
  * @returns Organization URL, or null if repo_url doesn't end with repo_name
59
59
  *
60
60
  * @example
@@ -70,7 +70,7 @@ export const url_github_org = (repo_url: string, repo_name: string): string | nu
70
70
  /**
71
71
  * Extract GitHub owner/org name from repository URL.
72
72
  *
73
- * @param repo_url Repository URL (e.g., 'https://github.com/owner/repo')
73
+ * @param repo_url - repository URL (e.g., 'https://github.com/owner/repo')
74
74
  * @returns Owner name, or null if not a valid GitHub URL
75
75
  *
76
76
  * @example
@@ -95,7 +95,7 @@ export const repo_url_github_owner = (repo_url: string): string | null => {
95
95
  /**
96
96
  * Build npm package URL.
97
97
  *
98
- * @param package_name Package name (can be scoped like '@org/package')
98
+ * @param package_name - package name (can be scoped like '@org/package')
99
99
  * @returns Full npm package page URL
100
100
  *
101
101
  * @example
@@ -115,7 +115,7 @@ export const url_npm_package = (package_name: string): string =>
115
115
  * - It has exports defined
116
116
  * - Its version is not the initial '0.0.1'
117
117
  *
118
- * @param package_json The package.json object to check
118
+ * @param package_json - the package.json object to check
119
119
  * @returns True if the package appears to be published
120
120
  */
121
121
  export const package_is_published = (package_json: PackageJson): boolean => {
@@ -125,7 +125,7 @@ export const package_is_published = (package_json: PackageJson): boolean => {
125
125
  /**
126
126
  * Extract repository name without scope from package name.
127
127
  *
128
- * @param name Package name (can be scoped like '@org/package')
128
+ * @param name - package name (can be scoped like '@org/package')
129
129
  * @returns Repository name without scope
130
130
  * @throws Error if scoped package name is malformed
131
131
  *
@@ -158,7 +158,7 @@ export const repo_name_parse = (name: string): string => {
158
158
  * Handles both string format and object format with `url` property.
159
159
  * Strips common prefixes ('git+') and suffixes ('.git', '/').
160
160
  *
161
- * @param repository The repository field from package.json
161
+ * @param repository - the repository field from package.json
162
162
  * @returns Clean repository URL, or null if not provided
163
163
  *
164
164
  * @example
@@ -189,8 +189,8 @@ export const repo_url_parse = (repository: PackageJson['repository']): string |
189
189
  /**
190
190
  * Build .well-known URL for package metadata files.
191
191
  *
192
- * @param homepage_url Package homepage URL
193
- * @param filename Filename in .well-known directory
192
+ * @param homepage_url - package homepage URL
193
+ * @param filename - filename in .well-known directory
194
194
  * @returns Full URL to the .well-known file
195
195
  *
196
196
  * @example
@@ -18,9 +18,9 @@ export const save_to_storage = (key: string, value: any, is_json = false): void
18
18
 
19
19
  /**
20
20
  * Utility function to load a value from `localStorage` with optional parsing
21
- * @param key The localStorage key
22
- * @param is_json Whether to parse the value as JSON
23
- * @param parse_fn Optional custom parsing function to transform the value
21
+ * @param key - the localStorage key
22
+ * @param is_json - whether to parse the value as JSON
23
+ * @param parse_fn - optional custom parsing function to transform the value
24
24
  * @returns The parsed value or null if not found or parsing fails
25
25
  */
26
26
  export const load_from_storage = <T>(
@@ -76,11 +76,11 @@ export interface SvelteFileAnalysis {
76
76
  * Returns raw analysis data matching `ModuleAnalysis` structure.
77
77
  * Consumer decides filtering policy (Svelte components are never nodocs).
78
78
  *
79
- * @param source_file The source file info (from Gro filer, file system, or other source)
80
- * @param module_path The module path (relative to source root)
81
- * @param checker TypeScript type checker
82
- * @param options Module source options for path extraction
83
- * @param ctx Analysis context for collecting diagnostics
79
+ * @param source_file - the source file info (from Gro filer, file system, or other source)
80
+ * @param module_path - the module path (relative to source root)
81
+ * @param checker - TypeScript type checker
82
+ * @param options - module source options for path extraction
83
+ * @param ctx - analysis context for collecting diagnostics
84
84
  * @returns Module analysis matching ModuleAnalysis structure
85
85
  */
86
86
  export const svelte_analyze_module = (
@@ -118,10 +118,10 @@ export const svelte_analyze_module = (
118
118
  *
119
119
  * Suitable for use in documentation generators, build tools, and analysis.
120
120
  *
121
- * @param source_file Source file info with path and content
122
- * @param module_path Module path relative to source root (e.g., 'Alert.svelte')
123
- * @param checker TypeScript type checker for type resolution
124
- * @param ctx Analysis context for collecting diagnostics
121
+ * @param source_file - source file info with path and content
122
+ * @param module_path - module path relative to source root (e.g., 'Alert.svelte')
123
+ * @param checker - TypeScript type checker for type resolution
124
+ * @param ctx - analysis context for collecting diagnostics
125
125
  * @returns Component declaration and optional module-level comment
126
126
  */
127
127
  export const svelte_analyze_file = (
@@ -98,7 +98,7 @@ const PRECOMPILED_NAME = 'MdzPrecompiled';
98
98
  /**
99
99
  * Creates a Svelte preprocessor that compiles static `Mdz` content at build time.
100
100
  *
101
- * @param options Configuration for component/element resolution and file filtering.
101
+ * @param options - configuration for component/element resolution and file filtering
102
102
  * @returns A Svelte `PreprocessorGroup` for use in `svelte.config.js`.
103
103
  */
104
104
  export const svelte_preprocess_mdz = (
@@ -63,8 +63,8 @@ export interface ModuleExportsAnalysis {
63
63
  /**
64
64
  * Create TypeScript program for analysis.
65
65
  *
66
- * @param options Configuration options for program creation
67
- * @param log Optional logger for info messages
66
+ * @param options - configuration options for program creation
67
+ * @param log - optional logger for info messages
68
68
  * @returns The program and type checker
69
69
  * @throws Error if tsconfig.json is not found
70
70
  */
@@ -100,12 +100,12 @@ export const ts_create_program = (options?: TsProgramOptions, log?: Logger): TsP
100
100
  * This is a high-level function suitable for building documentation or library metadata.
101
101
  * For lower-level analysis, use `ts_analyze_module_exports` directly.
102
102
  *
103
- * @param source_file_info The source file info (from Gro filer, file system, or other source)
104
- * @param ts_source_file TypeScript source file from the program
105
- * @param module_path The module path (relative to source root)
106
- * @param checker TypeScript type checker
107
- * @param options Module source options for path extraction
108
- * @param ctx Analysis context for collecting diagnostics
103
+ * @param source_file_info - the source file info (from Gro filer, file system, or other source)
104
+ * @param ts_source_file - TypeScript source file from the program
105
+ * @param module_path - the module path (relative to source root)
106
+ * @param checker - TypeScript type checker
107
+ * @param options - module source options for path extraction
108
+ * @param ctx - analysis context for collecting diagnostics
109
109
  * @returns Module metadata and re-export information
110
110
  */
111
111
  export const ts_analyze_module = (
@@ -151,10 +151,10 @@ export const ts_analyze_module = (
151
151
  * suitable for building documentation, API explorers, or analysis tools.
152
152
  * For standard SvelteKit library layouts, use `module_create_source_options(process.cwd())`.
153
153
  *
154
- * @param source_file The TypeScript source file to analyze
155
- * @param checker The TypeScript type checker
156
- * @param options Module source options for path extraction in re-exports
157
- * @param ctx Analysis context for collecting diagnostics
154
+ * @param source_file - the TypeScript source file to analyze
155
+ * @param checker - the TypeScript type checker
156
+ * @param options - module source options for path extraction in re-exports
157
+ * @param ctx - analysis context for collecting diagnostics
158
158
  * @returns Module comment, declarations, re-exports, and star exports
159
159
  */
160
160
  export const ts_analyze_module_exports = (
@@ -275,10 +275,10 @@ export const ts_analyze_module_exports = (
275
275
  * type analysis to produce complete declaration metadata. Suitable for use
276
276
  * in documentation generators, IDE integrations, and other tooling.
277
277
  *
278
- * @param symbol The TypeScript symbol to analyze
279
- * @param source_file The source file containing the symbol
280
- * @param checker The TypeScript type checker
281
- * @param ctx Optional analysis context for collecting diagnostics
278
+ * @param symbol - the TypeScript symbol to analyze
279
+ * @param source_file - the source file containing the symbol
280
+ * @param checker - the TypeScript type checker
281
+ * @param ctx - optional analysis context for collecting diagnostics
282
282
  * @returns Complete declaration metadata including docs, types, and parameters, plus nodocs flag
283
283
  */
284
284
  export const ts_analyze_declaration = (
@@ -431,9 +431,9 @@ export const ts_infer_declaration_kind = (symbol: ts.Symbol, node: ts.Node): Dec
431
431
  * Shared helper for extracting parameter information from both standalone functions
432
432
  * and class methods/constructors.
433
433
  *
434
- * @param sig The TypeScript signature to extract parameters from
435
- * @param checker TypeScript type checker for type resolution
436
- * @param tsdoc_params Map of parameter names to TSDoc descriptions (from tsdoc.params)
434
+ * @param sig - the TypeScript signature to extract parameters from
435
+ * @param checker - TypeScript type checker for type resolution
436
+ * @param tsdoc_params - map of parameter names to TSDoc descriptions (from tsdoc.params)
437
437
  * @returns Array of parameter info objects
438
438
  */
439
439
  export const ts_extract_signature_parameters = (
@@ -83,8 +83,8 @@ export interface TsdocParsedComment {
83
83
  * - `@since` - version information
84
84
  * - `@mutates` - mutation documentation (non-standard)
85
85
  *
86
- * @param node The TypeScript node to extract JSDoc from
87
- * @param source_file Source file (used for extracting full` @see` tag text)
86
+ * @param node - the TypeScript node to extract JSDoc from
87
+ * @param source_file - source file (used for extracting full ` @see` tag text)
88
88
  */
89
89
  export const tsdoc_parse = (
90
90
  node: ts.Node,
@@ -186,8 +186,8 @@ export const tsdoc_parse = (
186
186
  * Consolidates the common pattern of assigning TSDoc fields to declarations,
187
187
  * with conditional assignment for array fields (only if non-empty).
188
188
  *
189
- * @param declaration declaration object to update
190
- * @param tsdoc parsed TSDoc comment (if available)
189
+ * @param declaration - declaration object to update
190
+ * @param tsdoc - parsed TSDoc comment (if available)
191
191
  * @mutates declaration - adds doc_comment, deprecated_message, examples, see_also, throws, since fields
192
192
  */
193
193
  export const tsdoc_apply_to_declaration = (
@@ -219,7 +219,7 @@ export const tsdoc_apply_to_declaration = (
219
219
  *
220
220
  * Transforms `/** ... *\/` style comments into clean text.
221
221
  *
222
- * @param comment_text The raw comment text including `/**` and `*\/` markers
222
+ * @param comment_text - the raw comment text including `/**` and `*\/` markers
223
223
  * @returns Cleaned comment text, or undefined if empty after cleaning
224
224
  */
225
225
  export const tsdoc_clean_comment = (comment_text: string): string | undefined => {
@@ -8,7 +8,7 @@
8
8
  * @module
9
9
  */
10
10
 
11
- import {mdz_is_url} from './mdz.js';
11
+ import {mdz_is_url} from './mdz_helpers.js';
12
12
 
13
13
  /** Format a reference as mdz: URLs pass through, identifiers get backticks. */
14
14
  const format_reference = (ref: string): string => (mdz_is_url(ref) ? ref : `\`${ref}\``);