@diplodoc/tabs-extension 3.10.8-transform5.3 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -122,6 +122,25 @@ one-based line; it is not a general Markdown validator and does not promise a
122
122
  diagnostic for every malformed or unclosed marker. Directive attributes do not
123
123
  require general Markdown attributes to be enabled.
124
124
 
125
+ ### Observe item source titles
126
+
127
+ Pass `onItemSource(snapshot)` to `transform` to observe each accepted tab item
128
+ before its markup is generated, in both legacy and colon syntax. The callback
129
+ receives a frozen snapshot with `rawName`, a copied `inlineMap`, and a nullable
130
+ `containerMap` bounded by the owner's opening and closing token maps. Line maps
131
+ refer to the current normalized Markdown input and use zero-based, exclusive end
132
+ lines; they are not guaranteed offsets into an original file. Character spans
133
+ are zero-based UTF-16 offsets in `rawName`, with exclusive ends.
134
+
135
+ For `kind: 'ok'`, `markers` identifies the first custom anchor, the first
136
+ literal `{selected}` used for activation in the original title, and the first
137
+ literal removed from the display title after the anchor is removed. These ranges
138
+ can overlap or differ. `kind: 'unsupported'` reports `missing-title` or
139
+ `discontinuous-display-marker`; consumers should conservatively preserve the
140
+ affected source. Maps can be null and a consumer must establish an unambiguous
141
+ mapping to its own source before editing it. The callback may be called again
142
+ on later or nested parses and its exceptions propagate to the caller.
143
+
125
144
  ### Inspect legacy boundaries
126
145
 
127
146
  The pure `@diplodoc/tabs-extension/plugin` entry exports
@@ -72,7 +72,8 @@ export declare function tryToFindTabs(tokens: Token[], index: number): Result;
72
72
  * @param closeTokenIdx - Index of {% endlist %} paragraph
73
73
  * @param TokenConstructor - Token constructor from the current MarkdownIt state
74
74
  * @param end - Exclusive scan bound
75
+ * @param titleTokens - Optional association of returned items with their original inline title tokens
75
76
  * @returns Array of RuntimeTab
76
77
  */
77
- export declare function findTabs(tokens: Token[], idx: number, closeTokenIdx: number, TokenConstructor: StateCore['Token'], end: number): RuntimeTab[];
78
+ export declare function findTabs(tokens: Token[], idx: number, closeTokenIdx: number, TokenConstructor: StateCore['Token'], end: number, titleTokens?: WeakMap<RuntimeTab, Token>): RuntimeTab[];
78
79
  export {};