@diplodoc/notes-extension 0.0.0-stage → 0.1.0-transform5.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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -2
  3. package/build/cjs/browser/index.d.ts +23 -0
  4. package/build/cjs/browser.js +317 -0
  5. package/build/cjs/browser.js.map +7 -0
  6. package/build/cjs/index.js +356 -0
  7. package/build/cjs/index.js.map +7 -0
  8. package/build/cjs/package.json +1 -0
  9. package/build/cjs/plugin/close.d.ts +7 -0
  10. package/build/cjs/plugin/const.d.ts +19 -0
  11. package/build/cjs/plugin/index.d.ts +18 -0
  12. package/build/cjs/plugin/plugin.d.ts +8 -0
  13. package/build/cjs/plugin/pure.d.ts +4 -0
  14. package/build/cjs/plugin/resources.d.ts +9 -0
  15. package/build/cjs/plugin/transform.d.ts +17 -0
  16. package/build/cjs/plugin/types.d.ts +35 -0
  17. package/build/cjs/plugin.js +265 -0
  18. package/build/cjs/plugin.js.map +7 -0
  19. package/build/cjs/runtime/index.d.ts +1 -0
  20. package/build/esm/browser/index.d.ts +23 -0
  21. package/build/esm/browser.js +289 -0
  22. package/build/esm/browser.js.map +7 -0
  23. package/build/esm/index.js +328 -0
  24. package/build/esm/index.js.map +7 -0
  25. package/build/esm/package.json +1 -0
  26. package/build/esm/plugin/close.d.ts +7 -0
  27. package/build/esm/plugin/const.d.ts +19 -0
  28. package/build/esm/plugin/index.d.ts +18 -0
  29. package/build/esm/plugin/plugin.d.ts +8 -0
  30. package/build/esm/plugin/pure.d.ts +4 -0
  31. package/build/esm/plugin/resources.d.ts +9 -0
  32. package/build/esm/plugin/transform.d.ts +17 -0
  33. package/build/esm/plugin/types.d.ts +35 -0
  34. package/build/esm/plugin.js +235 -0
  35. package/build/esm/plugin.js.map +7 -0
  36. package/build/esm/runtime/index.d.ts +1 -0
  37. package/build/runtime/index.cjs +1 -0
  38. package/build/runtime/index.css +55 -0
  39. package/build/runtime/index.d.ts +1 -0
  40. package/build/runtime/index.mjs +1 -0
  41. package/build/scss/_notes.scss +87 -0
  42. package/build/types/browser/index.d.ts +23 -0
  43. package/build/types/plugin/close.d.ts +7 -0
  44. package/build/types/plugin/const.d.ts +19 -0
  45. package/build/types/plugin/index.d.ts +18 -0
  46. package/build/types/plugin/plugin.d.ts +8 -0
  47. package/build/types/plugin/pure.d.ts +4 -0
  48. package/build/types/plugin/resources.d.ts +9 -0
  49. package/build/types/plugin/transform.d.ts +17 -0
  50. package/build/types/plugin/types.d.ts +35 -0
  51. package/build/types/runtime/index.d.ts +1 -0
  52. package/package.json +88 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Yandex LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,90 @@
1
- # Temporary Holding Version
1
+ # Diplodoc notes extension
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A synchronous MarkdownIt plugin for the existing `{% note info %}` / `{% endnote %}` syntax. This is a Transform 5 prerelease candidate; publication is separate from source review.
4
+
5
+ ## Node use
6
+
7
+ ```typescript
8
+ import MarkdownIt from 'markdown-it';
9
+ import {transform, TokenType} from '@diplodoc/notes-extension';
10
+
11
+ const notes = transform({
12
+ runtime: {style: '_assets/notes-extension.css'},
13
+ });
14
+ const md = new MarkdownIt().use(notes, {
15
+ lang: 'fr',
16
+ notesAutotitle: true,
17
+ path: 'guide.md',
18
+ output: './public',
19
+ log: {warn: console.warn, error: console.error},
20
+ });
21
+ const env = {};
22
+ const source = '{% note info "Title" %}\n\nBody\n\n{% endnote %}';
23
+ const html = md.render(source, env);
24
+ notes.collect(source, {destRoot: './public', lang: 'fr'});
25
+ ```
26
+
27
+ The root exports named `transform` and `TokenType`, and a default namespace containing the same values. `transform()` returns a callable plugin with a typed `.collect()` method. CJS and ESM entry points are provided.
28
+
29
+ `lang`, `notesAutotitle`, `path` and `log` may be supplied as factory defaults or through the real `md.use(plugin, settings)` call. Defined callback settings override factory defaults. Language defaults to Russian, matching the accepted Transform notes behavior. Supported languages are ru, en, ar, cs, fr, es, he, bg, et, el, pt, zh, zh-tw, kk, tr and uz; unknown/empty values fall back to Russian.
30
+
31
+ Automatic titles remain enabled by default. `notesAutotitle: false` disables only the automatic title; explicit titles, inline title markup and explicit empty `""` titles retain their meaning. Supported kinds are info, tip, alert and warning. No colon syntax is added.
32
+
33
+ A supplied logger must implement both `warn` and `error`. Incorrect syntax is a warning; an unclosed note is an error. Messages and path precedence match the accepted implementation. Omitting the logger is explicitly quiet; it does not create a global logger.
34
+
35
+ ## Browser and prebundled hosts
36
+
37
+ ```typescript
38
+ import MarkdownIt from 'markdown-it';
39
+ import {transform} from '@diplodoc/notes-extension/browser';
40
+ import '@diplodoc/notes-extension/runtime/styles.css';
41
+
42
+ const md = new MarkdownIt().use(transform({runtime: false}), {lang: 'en'});
43
+ ```
44
+
45
+ Render HTML inside a `.yfm` container. The browser entry does not import Node modules, construct a parser, copy files or expose `.collect()`. Its optional `bundle` setting can only be false. Native13/14 browser hosts can use their official MarkdownIt browser distributions; their Node root entry has host-specific builtin requirements. Native15's ordinary root ESM entry is browser-bundle compatible. Extension graph purity does not change those host entry contracts.
46
+
47
+ `@diplodoc/notes-extension/plugin` exposes the pure `createNotesPlugin(formatPath?, onNote?)` factory, `TokenType`, the canonical `TITLES` dictionary, `DEFAULT_LANG`, and finite public types including `Lang`. The dictionary exports let retained Transform constants paths delegate to this single source. It emits no assets. Transform's built-in bridge can bind its existing diagnostic formatter and reuse its own bundled styles. No private MarkdownIt State imports or Transform dependency are required.
48
+
49
+ ## Resources and styles
50
+
51
+ - Default standalone resource: `_assets/notes-extension.css`. Notes have no active client JavaScript behavior; no script is emitted by default.
52
+ - `runtime: false`: no resource metadata or copies, suitable for a host that bundles CSS itself.
53
+ - `bundle: false`: retain resource references but do not copy files. Node default is true.
54
+ - `runtime: {style, script?}`: custom targets. An explicit legacy script target receives an empty classic-compatible runtime file.
55
+ - Legacy `runtime: 'path'` with `bundle:false` retains its historical mapping to both script and style references. Prefer the unambiguous object form. A string with copying enabled remains an error.
56
+ - `.collect(input, {destRoot, ...settings})` parses with the installed public MarkdownIt constructor and copies used assets to that destination. It returns void.
57
+
58
+ No real note means no resource emission/copy. Metadata is deduplicated in first-seen order, preserving authored values and arrays without mutating shared arrays. Resource metadata must be an object. A fresh document must use a fresh environment; copying is deduplicated by environment identity and actual destination, without a global cache.
59
+
60
+ `/runtime/styles` and `/runtime/styles.css` resolve to the same scoped CSS including print behavior. `/runtime` remains an importable empty compatibility entry. `/scss/notes` provides the canonical `notes-body` and `notes-print` mixins so host bundles can retain their original cascade positions without duplicating CSS. Do not import both compiled CSS and the same mixins into one output.
61
+
62
+ Use Sass's [Node package importer](https://sass-lang.com/documentation/js-api/classes/nodepackageimporter/) for the public mixin entry:
63
+
64
+ ```scss
65
+ @use 'pkg:@diplodoc/notes-extension/scss/notes';
66
+
67
+ .yfm .yfm-note {
68
+ @include notes.notes-body;
69
+ }
70
+
71
+ @include notes.notes-print;
72
+ ```
73
+
74
+ Enable that importer with `importers: [new sass.NodePackageImporter()]` in the Sass JavaScript API, or `--pkg-importer=node` in its CLI. With `esbuild-sass-plugin`, the supported Node resolution spelling is `@use '~@diplodoc/notes-extension/scss/notes';`. A bare Sass import without a package resolver does not resolve package exports.
75
+
76
+ The old private prototype advertised `/react` without any source/build target. That placeholder is removed; this package does not implement a React component. Existing supported Transform notes paths must remain bridges under its separate deprecation policy.
77
+
78
+ ## Validation and development
79
+
80
+ ```sh
81
+ npm ci
82
+ npm run typecheck
83
+ npm test
84
+ npm run build
85
+ npx playwright install chromium
86
+ npm run test:package
87
+ npm run lint
88
+ ```
89
+
90
+ The installed package gate checks native13/14/15, strict CJS/ESM declarations, all export targets, real copy/collect/resources, and actual browser/style behavior. Tests do not update visual snapshots. Stable adoption requires a separate release decision and actual consumer migration checks.
@@ -0,0 +1,23 @@
1
+ import type { NotesOptions, NotesPlugin } from '../plugin/types.js';
2
+ import type { RuntimeOption } from '../plugin/resources.js';
3
+ import { TokenType } from '../plugin/const.js';
4
+ export type TransformOptions = NotesOptions & {
5
+ runtime?: RuntimeOption;
6
+ bundle?: false;
7
+ };
8
+ export declare function transform(options?: TransformOptions): NotesPlugin;
9
+ export { TokenType };
10
+ export type { NotesOptions, NotesLogger } from '../plugin/types.js';
11
+ declare const _default: {
12
+ transform: typeof transform;
13
+ TokenType: {
14
+ readonly Note: "yfm-note";
15
+ readonly NoteOpen: "yfm_note_open";
16
+ readonly NoteClose: "yfm_note_close";
17
+ readonly NoteTitleOpen: "yfm_note_title_open";
18
+ readonly NoteTitleClose: "yfm_note_title_close";
19
+ readonly NoteContentOpen: "yfm_note_content_open";
20
+ readonly NoteContentClose: "yfm_note_content_close";
21
+ };
22
+ };
23
+ export default _default;
@@ -0,0 +1,317 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/browser/index.ts
21
+ var browser_exports = {};
22
+ __export(browser_exports, {
23
+ TokenType: () => TokenType,
24
+ default: () => browser_default,
25
+ transform: () => transform
26
+ });
27
+ module.exports = __toCommonJS(browser_exports);
28
+
29
+ // src/plugin/close.ts
30
+ function createNestedCloseTokenIdxFactory(formatPath) {
31
+ const nestedCloseTokenIdxFactory = (tokenName, matchOpenToken2, matchCloseToken2) => (tokens, idx, path, log) => {
32
+ let level = 0;
33
+ let i = idx;
34
+ while (i < tokens.length) {
35
+ if (matchOpenToken2(tokens, i)) {
36
+ level++;
37
+ } else if (matchCloseToken2(tokens, i)) {
38
+ if (level === 0) {
39
+ return i;
40
+ }
41
+ level--;
42
+ }
43
+ i++;
44
+ }
45
+ log.error(`${tokenName} must be closed${path ? ` in ${formatPath(path)}` : ""}`);
46
+ return null;
47
+ };
48
+ return nestedCloseTokenIdxFactory;
49
+ }
50
+
51
+ // src/plugin/const.ts
52
+ var DEFAULT_LANG = "ru";
53
+ var TITLES = {
54
+ ru: {
55
+ info: "\u041F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435",
56
+ tip: "\u0421\u043E\u0432\u0435\u0442",
57
+ alert: "\u0412\u043D\u0438\u043C\u0430\u043D\u0438\u0435",
58
+ warning: "\u0412\u0430\u0436\u043D\u043E"
59
+ },
60
+ en: {
61
+ info: "Note",
62
+ tip: "Tip",
63
+ alert: "Alert",
64
+ warning: "Warning"
65
+ },
66
+ ar: {
67
+ info: "\u0645\u0644\u0627\u062D\u0638\u0629",
68
+ tip: "\u0646\u0635\u064A\u062D\u0629",
69
+ alert: "\u0627\u0646\u062A\u0628\u0627\u0647",
70
+ warning: "\u0647\u0627\u0645"
71
+ },
72
+ cs: {
73
+ info: "Pozn\xE1mka",
74
+ tip: "Tip",
75
+ alert: "Upozorn\u011Bn\xED",
76
+ warning: "Varov\xE1n\xED"
77
+ },
78
+ fr: {
79
+ info: "Remarque",
80
+ tip: "Astuce",
81
+ alert: "Alerte",
82
+ warning: "Avertissement"
83
+ },
84
+ es: {
85
+ info: "Nota",
86
+ tip: "Consejo",
87
+ alert: "Alerta",
88
+ warning: "Aviso"
89
+ },
90
+ he: {
91
+ info: "\u05DE\u05D9\u05D3\u05E2",
92
+ tip: "\u05D8\u05D9\u05E4",
93
+ alert: "\u05D4\u05EA\u05E8\u05D0\u05D4",
94
+ warning: "\u05D0\u05D6\u05D4\u05E8\u05D4"
95
+ },
96
+ bg: {
97
+ info: "\u0417\u0430\u0431\u0435\u043B\u0435\u0436\u043A\u0430",
98
+ tip: "\u0421\u044A\u0432\u0435\u0442",
99
+ alert: "\u0412\u043D\u0438\u043C\u0430\u043D\u0438\u0435",
100
+ warning: "\u0412\u0430\u0436\u043D\u043E"
101
+ },
102
+ et: {
103
+ info: "M\xE4rkus",
104
+ tip: "N\xF5uanne",
105
+ alert: "T\xE4helepanu",
106
+ warning: "T\xE4htis"
107
+ },
108
+ el: {
109
+ info: "\u03A3\u03B7\u03BC\u03B5\u03AF\u03C9\u03C3\u03B7",
110
+ tip: "\u03A3\u03C5\u03BC\u03B2\u03BF\u03C5\u03BB\u03AE",
111
+ alert: "\u03A0\u03C1\u03BF\u03C3\u03BF\u03C7\u03AE",
112
+ warning: "\u03A3\u03B7\u03BC\u03B1\u03BD\u03C4\u03B9\u03BA\u03CC"
113
+ },
114
+ pt: {
115
+ info: "Observa\xE7\xE3o",
116
+ tip: "Sugest\xE3o",
117
+ alert: "Aten\xE7\xE3o",
118
+ warning: "Importante"
119
+ },
120
+ zh: {
121
+ info: "\u5907\u6CE8",
122
+ tip: "\u63D0\u793A",
123
+ alert: "\u6CE8\u610F",
124
+ warning: "\u91CD\u8981"
125
+ },
126
+ "zh-tw": {
127
+ info: "\u5099\u6CE8",
128
+ tip: "\u63D0\u793A",
129
+ alert: "\u6CE8\u610F",
130
+ warning: "\u91CD\u8981"
131
+ },
132
+ kk: {
133
+ info: "\u0415\u0441\u043A\u0435\u0440\u0442\u0443",
134
+ tip: "\u041A\u0435\u04A3\u0435\u0441",
135
+ alert: "\u041D\u0430\u0437\u0430\u0440 \u0430\u0443\u0434\u0430\u0440\u044B\u04A3\u044B\u0437",
136
+ warning: "\u041C\u0430\u04A3\u044B\u0437\u0434\u044B"
137
+ },
138
+ tr: {
139
+ info: "Not",
140
+ tip: "\xD6neri",
141
+ alert: "Dikkat",
142
+ warning: "\xD6nemli"
143
+ },
144
+ uz: {
145
+ info: "Sharh",
146
+ tip: "Maslahat",
147
+ alert: "Diqqat",
148
+ warning: "Bu muhim"
149
+ }
150
+ };
151
+ var TokenType = {
152
+ Note: "yfm-note",
153
+ NoteOpen: "yfm_note_open",
154
+ NoteClose: "yfm_note_close",
155
+ NoteTitleOpen: "yfm_note_title_open",
156
+ NoteTitleClose: "yfm_note_title_close",
157
+ NoteContentOpen: "yfm_note_content_open",
158
+ NoteContentClose: "yfm_note_content_close"
159
+ };
160
+
161
+ // src/plugin/plugin.ts
162
+ var quietLogger = { warn: (_message) => {
163
+ }, error: (_message) => {
164
+ } };
165
+ var ALERT_RE = /^{% note (alert|info|tip|warning)\s*(?:"(.*?)")? %}$/;
166
+ var WRONG_NOTES = /^{% note (.*)%}/;
167
+ var matchCloseToken = (tokens, i) => {
168
+ return tokens[i].type === "paragraph_open" && tokens[i + 1].type === "inline" && tokens[i + 1].content.trim() === "{% endnote %}";
169
+ };
170
+ var titleDictionaries = new Map(Object.entries(TITLES));
171
+ function getTitle(type, lang) {
172
+ return (titleDictionaries.get(lang) ?? TITLES.ru)[type];
173
+ }
174
+ function matchOpenToken(tokens, i) {
175
+ return tokens[i].type === "paragraph_open" && tokens[i + 1].type === "inline" && tokens[i + 1].content.match(ALERT_RE);
176
+ }
177
+ function matchWrongNotes(tokens, i) {
178
+ return tokens[i].type === "paragraph_open" && tokens[i + 1].type === "inline" && tokens[i + 1].content.match(WRONG_NOTES);
179
+ }
180
+ function createNotesPlugin(formatPath = (path) => path, onNote) {
181
+ const findCloseTokenIdx = createNestedCloseTokenIdxFactory(formatPath)(
182
+ "Note",
183
+ matchOpenToken,
184
+ matchCloseToken
185
+ );
186
+ const index = (md, { lang = DEFAULT_LANG, notesAutotitle, path: optPath, log = quietLogger } = {}) => {
187
+ notesAutotitle = typeof notesAutotitle === "boolean" ? notesAutotitle : true;
188
+ const plugin = (state) => {
189
+ const { tokens, env } = state;
190
+ const path = typeof env.path === "string" && env.path ? env.path : optPath ?? "";
191
+ let i = 0;
192
+ while (i < tokens.length) {
193
+ const match = matchOpenToken(tokens, i);
194
+ if (match) {
195
+ const closeTokenIdx = findCloseTokenIdx(tokens, i + 2, path, log);
196
+ if (!closeTokenIdx) {
197
+ i += 3;
198
+ continue;
199
+ }
200
+ const type = match[1].toLowerCase();
201
+ const newOpenToken = new state.Token("yfm_note_open", "div", 1);
202
+ newOpenToken.attrSet("class", `yfm-note yfm-accent-${type}`);
203
+ newOpenToken.attrSet("note-type", type);
204
+ newOpenToken.map = tokens[i].map;
205
+ const closeTokenMap = tokens[closeTokenIdx].map;
206
+ if (closeTokenMap && newOpenToken.map) {
207
+ newOpenToken.map[1] = closeTokenMap[1];
208
+ }
209
+ const newCloseToken = new state.Token("yfm_note_close", "div", -1);
210
+ newCloseToken.map = tokens[closeTokenIdx].map;
211
+ const titleOpen = new state.Token("yfm_note_title_open", "p", 1);
212
+ titleOpen.attrSet("class", "yfm-note-title");
213
+ const autotitle = notesAutotitle ? getTitle(type, lang) : "";
214
+ const titleContent = match[2] === void 0 ? autotitle : match[2];
215
+ const titleInline = state.md.parseInline(titleContent, state.env)[0];
216
+ titleInline.map = null;
217
+ const titleClose = new state.Token("yfm_note_title_close", "p", -1);
218
+ titleOpen.block = true;
219
+ titleClose.block = true;
220
+ const contentOpen = new state.Token("yfm_note_content_open", "div", 1);
221
+ contentOpen.attrSet("class", "yfm-note-content");
222
+ const contentClose = new state.Token("yfm_note_content_close", "div", -1);
223
+ if (newOpenToken.map) {
224
+ contentOpen.map = [newOpenToken.map[0] + 2, newOpenToken.map[1] - 2];
225
+ }
226
+ const insideTokens = [newOpenToken];
227
+ if (titleInline.content) {
228
+ insideTokens.push(titleOpen, titleInline, titleClose);
229
+ }
230
+ insideTokens.push(
231
+ contentOpen,
232
+ ...tokens.slice(i + 3, closeTokenIdx),
233
+ contentClose,
234
+ newCloseToken
235
+ );
236
+ tokens.splice(i, closeTokenIdx - i + 3, ...insideTokens);
237
+ onNote?.(env);
238
+ i++;
239
+ } else if (matchWrongNotes(tokens, i) && tokens[i + 1].content !== "{% endnote %}") {
240
+ log.warn(
241
+ `Incorrect syntax for notes${path ? `, file ${formatPath(path)}` : ""}`
242
+ );
243
+ i += 3;
244
+ } else {
245
+ i++;
246
+ }
247
+ }
248
+ };
249
+ try {
250
+ md.core.ruler.before("curly_attributes", "notes", plugin);
251
+ } catch {
252
+ md.core.ruler.push("notes", plugin);
253
+ }
254
+ };
255
+ return index;
256
+ }
257
+
258
+ // src/plugin/resources.ts
259
+ function normalizeRuntime(runtime, bundle = false) {
260
+ if (runtime === false) return false;
261
+ if (typeof runtime === "string") {
262
+ if (bundle)
263
+ throw new TypeError("Option `runtime` should be record when `bundle` is enabled.");
264
+ return { script: runtime, style: runtime };
265
+ }
266
+ return runtime ?? { style: "_assets/notes-extension.css" };
267
+ }
268
+ function semanticOptions(defaults, settings) {
269
+ return {
270
+ lang: settings.lang === void 0 ? defaults.lang : settings.lang,
271
+ notesAutotitle: settings.notesAutotitle === void 0 ? defaults.notesAutotitle : settings.notesAutotitle,
272
+ path: settings.path === void 0 ? defaults.path : settings.path,
273
+ log: settings.log === void 0 ? defaults.log : settings.log
274
+ };
275
+ }
276
+ function isRecord(value) {
277
+ return value !== null && typeof value === "object" && !Array.isArray(value);
278
+ }
279
+ function addResources(env, runtime) {
280
+ const previous = env.meta;
281
+ if (previous !== void 0 && !isRecord(previous)) {
282
+ throw new TypeError("Notes resource metadata must be an object.");
283
+ }
284
+ const meta = { ...previous };
285
+ for (const key of ["style", "script"]) {
286
+ const resource = runtime[key];
287
+ if (!resource) continue;
288
+ const existing = meta[key];
289
+ let values = [];
290
+ if (Array.isArray(existing)) values = [...existing];
291
+ else if (existing !== void 0) values = [existing];
292
+ if (!values.includes(resource)) values.push(resource);
293
+ meta[key] = values;
294
+ }
295
+ env.meta = meta;
296
+ }
297
+
298
+ // src/browser/index.ts
299
+ function transform(options = {}) {
300
+ if (options.bundle !== void 0 && options.bundle !== false) {
301
+ throw new TypeError("Browser notes extension cannot copy runtime files.");
302
+ }
303
+ const runtime = normalizeRuntime(options.runtime);
304
+ return function plugin(md, settings = {}) {
305
+ createNotesPlugin(void 0, runtime ? (env) => addResources(env, runtime) : void 0)(
306
+ md,
307
+ semanticOptions(options, settings)
308
+ );
309
+ };
310
+ }
311
+ var browser_default = { transform, TokenType };
312
+ // Annotate the CommonJS export names for ESM import in node:
313
+ 0 && (module.exports = {
314
+ TokenType,
315
+ transform
316
+ });
317
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/browser/index.ts", "../../src/plugin/close.ts", "../../src/plugin/const.ts", "../../src/plugin/plugin.ts", "../../src/plugin/resources.ts"],
4
+ "sourcesContent": ["import type {NoteParser, NoteToken, NotesOptions, NotesPlugin} from '../plugin/types.js';\nimport type {RuntimeOption} from '../plugin/resources.js';\n\nimport {createNotesPlugin} from '../plugin/plugin.js';\nimport {addResources, normalizeRuntime, semanticOptions} from '../plugin/resources.js';\nimport {TokenType} from '../plugin/const.js';\n\nexport type TransformOptions = NotesOptions & {runtime?: RuntimeOption; bundle?: false};\nexport function transform(options: TransformOptions = {}): NotesPlugin {\n if (options.bundle !== undefined && options.bundle !== false) {\n throw new TypeError('Browser notes extension cannot copy runtime files.');\n }\n const runtime = normalizeRuntime(options.runtime);\n return function plugin<Token extends NoteToken>(\n md: NoteParser<Token>,\n settings: NotesOptions = {},\n ): void {\n createNotesPlugin(undefined, runtime ? (env) => addResources(env, runtime) : undefined)(\n md,\n semanticOptions(options, settings),\n );\n };\n}\nexport {TokenType};\nexport type {NotesOptions, NotesLogger} from '../plugin/types.js';\nexport default {transform, TokenType};\n", "import type {MatchTokenFunction, NoteToken, NotesLogger} from './types.js';\n\n/**\n * Bind the existing close-token search to the host's path formatter.\n * @param formatPath - Plain browser or original terminal path formatting.\n * @returns The existing finite token-search factory.\n */\nexport function createNestedCloseTokenIdxFactory(formatPath: (path: string) => string) {\n const nestedCloseTokenIdxFactory =\n (\n tokenName: string,\n matchOpenToken: MatchTokenFunction,\n matchCloseToken: MatchTokenFunction,\n ) =>\n (tokens: NoteToken[], idx: number, path: string, log: NotesLogger) => {\n let level = 0;\n let i = idx;\n while (i < tokens.length) {\n if (matchOpenToken(tokens, i)) {\n level++;\n } else if (matchCloseToken(tokens, i)) {\n if (level === 0) {\n return i;\n }\n level--;\n }\n\n i++;\n }\n\n log.error(`${tokenName} must be closed${path ? ` in ${formatPath(path)}` : ''}`);\n\n return null;\n };\n\n return nestedCloseTokenIdxFactory;\n}\n", "export const ENV_FLAG_NAME = 'has-yfm-notes';\nexport const DEFAULT_LANG = 'ru';\n\nexport type Lang =\n | 'ru'\n | 'en'\n | 'ar'\n | 'cs'\n | 'fr'\n | 'es'\n | 'he'\n | 'bg'\n | 'et'\n | 'el'\n | 'pt'\n | 'zh'\n | 'zh-tw'\n | 'kk'\n | 'tr'\n | 'uz';\n\nexport const TITLES: Record<Lang, Record<string, string>> = {\n ru: {\n info: '\u041F\u0440\u0438\u043C\u0435\u0447\u0430\u043D\u0438\u0435',\n tip: '\u0421\u043E\u0432\u0435\u0442',\n alert: '\u0412\u043D\u0438\u043C\u0430\u043D\u0438\u0435',\n warning: '\u0412\u0430\u0436\u043D\u043E',\n },\n en: {\n info: 'Note',\n tip: 'Tip',\n alert: 'Alert',\n warning: 'Warning',\n },\n ar: {\n info: '\u0645\u0644\u0627\u062D\u0638\u0629',\n tip: '\u0646\u0635\u064A\u062D\u0629',\n alert: '\u0627\u0646\u062A\u0628\u0627\u0647',\n warning: '\u0647\u0627\u0645',\n },\n cs: {\n info: 'Pozn\u00E1mka',\n tip: 'Tip',\n alert: 'Upozorn\u011Bn\u00ED',\n warning: 'Varov\u00E1n\u00ED',\n },\n fr: {\n info: 'Remarque',\n tip: 'Astuce',\n alert: 'Alerte',\n warning: 'Avertissement',\n },\n es: {\n info: 'Nota',\n tip: 'Consejo',\n alert: 'Alerta',\n warning: 'Aviso',\n },\n he: {\n info: '\u05DE\u05D9\u05D3\u05E2',\n tip: '\u05D8\u05D9\u05E4',\n alert: '\u05D4\u05EA\u05E8\u05D0\u05D4',\n warning: '\u05D0\u05D6\u05D4\u05E8\u05D4',\n },\n bg: {\n info: '\u0417\u0430\u0431\u0435\u043B\u0435\u0436\u043A\u0430',\n tip: '\u0421\u044A\u0432\u0435\u0442',\n alert: '\u0412\u043D\u0438\u043C\u0430\u043D\u0438\u0435',\n warning: '\u0412\u0430\u0436\u043D\u043E',\n },\n et: {\n info: 'M\u00E4rkus',\n tip: 'N\u00F5uanne',\n alert: 'T\u00E4helepanu',\n warning: 'T\u00E4htis',\n },\n el: {\n info: '\u03A3\u03B7\u03BC\u03B5\u03AF\u03C9\u03C3\u03B7',\n tip: '\u03A3\u03C5\u03BC\u03B2\u03BF\u03C5\u03BB\u03AE',\n alert: '\u03A0\u03C1\u03BF\u03C3\u03BF\u03C7\u03AE',\n warning: '\u03A3\u03B7\u03BC\u03B1\u03BD\u03C4\u03B9\u03BA\u03CC',\n },\n pt: {\n info: 'Observa\u00E7\u00E3o',\n tip: 'Sugest\u00E3o',\n alert: 'Aten\u00E7\u00E3o',\n warning: 'Importante',\n },\n zh: {\n info: '\u5907\u6CE8',\n tip: '\u63D0\u793A',\n alert: '\u6CE8\u610F',\n warning: '\u91CD\u8981',\n },\n 'zh-tw': {\n info: '\u5099\u6CE8',\n tip: '\u63D0\u793A',\n alert: '\u6CE8\u610F',\n warning: '\u91CD\u8981',\n },\n kk: {\n info: '\u0415\u0441\u043A\u0435\u0440\u0442\u0443',\n tip: '\u041A\u0435\u04A3\u0435\u0441',\n alert: '\u041D\u0430\u0437\u0430\u0440 \u0430\u0443\u0434\u0430\u0440\u044B\u04A3\u044B\u0437',\n warning: '\u041C\u0430\u04A3\u044B\u0437\u0434\u044B',\n },\n tr: {\n info: 'Not',\n tip: '\u00D6neri',\n alert: 'Dikkat',\n warning: '\u00D6nemli',\n },\n uz: {\n info: 'Sharh',\n tip: 'Maslahat',\n alert: 'Diqqat',\n warning: 'Bu muhim',\n },\n};\n\nexport const TokenType = {\n Note: 'yfm-note',\n NoteOpen: 'yfm_note_open',\n NoteClose: 'yfm_note_close',\n NoteTitleOpen: 'yfm_note_title_open',\n NoteTitleClose: 'yfm_note_title_close',\n NoteContentOpen: 'yfm_note_content_open',\n NoteContentClose: 'yfm_note_content_close',\n} as const;\n\nexport const ClassNames = {\n Note: 'yfm-note',\n Accent: 'yfm-accent',\n Title: 'yfm-note-title',\n Content: 'yfm-note-content',\n} as const;\n", "import type {\n MatchTokenFunction,\n NoteParser,\n NoteState,\n NoteToken,\n NotesOptions,\n NotesPlugin,\n} from './types.js';\n\nimport {createNestedCloseTokenIdxFactory} from './close.js';\nimport {DEFAULT_LANG, TITLES} from './const.js';\n\nconst quietLogger = {warn: (_message: string) => {}, error: (_message: string) => {}};\n\nconst ALERT_RE = /^{% note (alert|info|tip|warning)\\s*(?:\"(.*?)\")? %}$/;\nconst WRONG_NOTES = /^{% note (.*)%}/;\n\nconst matchCloseToken: MatchTokenFunction = (tokens, i) => {\n return (\n tokens[i].type === 'paragraph_open' &&\n tokens[i + 1].type === 'inline' &&\n tokens[i + 1].content.trim() === '{% endnote %}'\n );\n};\n\nconst titleDictionaries = new Map(Object.entries(TITLES));\n\nfunction getTitle(type: string, lang: string) {\n return (titleDictionaries.get(lang) ?? TITLES.ru)[type];\n}\n\nfunction matchOpenToken(tokens: NoteToken[], i: number) {\n return (\n tokens[i].type === 'paragraph_open' &&\n tokens[i + 1].type === 'inline' &&\n tokens[i + 1].content.match(ALERT_RE)\n );\n}\n\nfunction matchWrongNotes(tokens: NoteToken[], i: number) {\n return (\n tokens[i].type === 'paragraph_open' &&\n tokens[i + 1].type === 'inline' &&\n tokens[i + 1].content.match(WRONG_NOTES)\n );\n}\n\n/**\n * Bind existing feature diagnostics to an execution-host path formatter.\n * @param formatPath - Original terminal or plain browser formatting.\n * @param onNote - Optional host resource notification after a real note is created.\n * @returns The unchanged feature callback.\n */\nexport function createNotesPlugin(\n formatPath: (path: string) => string = (path) => path,\n onNote?: (env: Record<string, unknown>) => void,\n): NotesPlugin {\n const findCloseTokenIdx = createNestedCloseTokenIdxFactory(formatPath)(\n 'Note',\n matchOpenToken,\n matchCloseToken,\n );\n\n const index: NotesPlugin = <Token extends NoteToken>(\n md: NoteParser<Token>,\n {lang = DEFAULT_LANG, notesAutotitle, path: optPath, log = quietLogger}: NotesOptions = {},\n ) => {\n notesAutotitle = typeof notesAutotitle === 'boolean' ? notesAutotitle : true;\n\n const plugin = (state: NoteState<Token>) => {\n const {tokens, env} = state;\n const path = typeof env.path === 'string' && env.path ? env.path : (optPath ?? '');\n let i = 0;\n\n while (i < tokens.length) {\n const match = matchOpenToken(tokens, i);\n\n if (match) {\n // Skip paragraph_close for open token (+1) and paragraph_open for close token (+1)\n // This is minimal useless content length\n const closeTokenIdx = findCloseTokenIdx(tokens, i + 2, path, log);\n\n if (!closeTokenIdx) {\n i += 3;\n continue;\n }\n\n const type = match[1].toLowerCase();\n const newOpenToken = new state.Token('yfm_note_open', 'div', 1);\n newOpenToken.attrSet('class', `yfm-note yfm-accent-${type}`);\n newOpenToken.attrSet('note-type', type);\n newOpenToken.map = tokens[i].map;\n const closeTokenMap = tokens[closeTokenIdx].map;\n\n if (closeTokenMap && newOpenToken.map) {\n newOpenToken.map[1] = closeTokenMap[1];\n }\n\n const newCloseToken = new state.Token('yfm_note_close', 'div', -1);\n newCloseToken.map = tokens[closeTokenIdx].map;\n\n // Add extra paragraph\n const titleOpen = new state.Token('yfm_note_title_open', 'p', 1);\n titleOpen.attrSet('class', 'yfm-note-title');\n const autotitle = notesAutotitle ? getTitle(type, lang) : '';\n const titleContent = match[2] === undefined ? autotitle : match[2];\n const titleInline = state.md.parseInline(titleContent, state.env)[0];\n titleInline.map = null;\n const titleClose = new state.Token('yfm_note_title_close', 'p', -1);\n\n titleOpen.block = true;\n titleClose.block = true;\n\n const contentOpen = new state.Token('yfm_note_content_open', 'div', 1);\n contentOpen.attrSet('class', 'yfm-note-content');\n const contentClose = new state.Token('yfm_note_content_close', 'div', -1);\n\n if (newOpenToken.map) {\n contentOpen.map = [newOpenToken.map[0] + 2, newOpenToken.map[1] - 2];\n }\n\n const insideTokens = [newOpenToken];\n if (titleInline.content) {\n insideTokens.push(titleOpen, titleInline, titleClose);\n }\n\n insideTokens.push(\n contentOpen,\n ...tokens.slice(i + 3, closeTokenIdx),\n contentClose,\n newCloseToken,\n );\n\n tokens.splice(i, closeTokenIdx - i + 3, ...insideTokens);\n\n onNote?.(env);\n i++;\n } else if (\n matchWrongNotes(tokens, i) &&\n tokens[i + 1].content !== '{% endnote %}'\n ) {\n log.warn(\n `Incorrect syntax for notes${path ? `, file ${formatPath(path)}` : ''}`,\n );\n\n i += 3;\n } else {\n i++;\n }\n }\n };\n\n try {\n md.core.ruler.before('curly_attributes', 'notes', plugin);\n } catch {\n md.core.ruler.push('notes', plugin);\n }\n };\n\n return index;\n}\n", "import type {NotesOptions} from './types.js';\n\nexport type Runtime = {style: string; script?: string};\nexport type RuntimeOption = false | string | Runtime;\n\nexport function normalizeRuntime(runtime?: RuntimeOption, bundle = false): Runtime | false {\n if (runtime === false) return false;\n if (typeof runtime === 'string') {\n if (bundle)\n throw new TypeError('Option `runtime` should be record when `bundle` is enabled.');\n return {script: runtime, style: runtime};\n }\n return runtime ?? {style: '_assets/notes-extension.css'};\n}\n\nexport function semanticOptions(defaults: NotesOptions, settings: NotesOptions): NotesOptions {\n return {\n lang: settings.lang === undefined ? defaults.lang : settings.lang,\n notesAutotitle:\n settings.notesAutotitle === undefined\n ? defaults.notesAutotitle\n : settings.notesAutotitle,\n path: settings.path === undefined ? defaults.path : settings.path,\n log: settings.log === undefined ? defaults.log : settings.log,\n };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport function addResources(env: Record<string, unknown>, runtime: Runtime): void {\n const previous = env.meta;\n if (previous !== undefined && !isRecord(previous)) {\n throw new TypeError('Notes resource metadata must be an object.');\n }\n const meta = {...previous};\n for (const key of ['style', 'script'] as const) {\n const resource = runtime[key];\n if (!resource) continue;\n const existing = meta[key];\n let values: unknown[] = [];\n if (Array.isArray(existing)) values = [...existing];\n else if (existing !== undefined) values = [existing];\n if (!values.includes(resource)) values.push(resource);\n meta[key] = values;\n }\n env.meta = meta;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,SAAS,iCAAiC,YAAsC;AACnF,QAAM,6BACF,CACI,WACAA,iBACAC,qBAEJ,CAAC,QAAqB,KAAa,MAAc,QAAqB;AAClE,QAAI,QAAQ;AACZ,QAAI,IAAI;AACR,WAAO,IAAI,OAAO,QAAQ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