@mrsf/marp-mrsf 0.4.8
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/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/browser.d.ts +6 -0
- package/dist/browser.js +317 -0
- package/dist/browser.js.map +7 -0
- package/dist/controller.d.ts +173 -0
- package/dist/controller.js +1179 -0
- package/dist/controller.js.map +7 -0
- package/dist/gutter.d.ts +50 -0
- package/dist/html.d.ts +13 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +353 -0
- package/dist/index.js.map +7 -0
- package/dist/rules/core.d.ts +17 -0
- package/dist/rules/renderer.d.ts +10 -0
- package/dist/shared.d.ts +20 -0
- package/dist/style.css +522 -0
- package/dist/types.d.ts +105 -0
- package/package.json +85 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for MRSF rendering plugins.
|
|
3
|
+
*
|
|
4
|
+
* These types are used by both @mrsf/markdown-it-mrsf and @mrsf/rehype-mrsf.
|
|
5
|
+
*/
|
|
6
|
+
import type { MrsfDocument } from "@mrsf/cli";
|
|
7
|
+
/** Base options shared by all MRSF rendering plugins. */
|
|
8
|
+
export interface MrsfPluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Path to the Markdown document on disk.
|
|
11
|
+
* Used for auto-discovery of the sidecar file via `@mrsf/cli`.
|
|
12
|
+
*/
|
|
13
|
+
documentPath?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Explicit path to the `.review.yaml` or `.review.json` sidecar file.
|
|
16
|
+
* Takes precedence over auto-discovery.
|
|
17
|
+
*/
|
|
18
|
+
sidecarPath?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Pre-loaded MRSF sidecar data.
|
|
21
|
+
* Takes precedence over `loader`, `sidecarPath`, and `documentPath`.
|
|
22
|
+
* Enables browser use, custom pipelines, and testing.
|
|
23
|
+
*/
|
|
24
|
+
comments?: MrsfDocument;
|
|
25
|
+
/**
|
|
26
|
+
* Custom loader function that returns sidecar data.
|
|
27
|
+
* Takes precedence over `sidecarPath` and `documentPath`.
|
|
28
|
+
* Useful for integrations that manage their own sidecar state.
|
|
29
|
+
*/
|
|
30
|
+
loader?: (options: MrsfPluginOptions, env?: unknown) => MrsfDocument | null;
|
|
31
|
+
/** Whether to show resolved comments (default: true). */
|
|
32
|
+
showResolved?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* How serialized review data should be embedded into rendered HTML.
|
|
35
|
+
* - `script`: emits `<script type="application/mrsf+json">` (default)
|
|
36
|
+
* - `element`: emits a hidden element with JSON in a data attribute
|
|
37
|
+
*/
|
|
38
|
+
dataContainer?: "script" | "element";
|
|
39
|
+
/**
|
|
40
|
+
* Element id used when `dataContainer` is set to `element`.
|
|
41
|
+
* Default: `mrsf-comment-data`.
|
|
42
|
+
*/
|
|
43
|
+
dataElementId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Enable interactive mode — adds action buttons with `data-mrsf-action`
|
|
46
|
+
* attributes for host applications to hook into (default: false).
|
|
47
|
+
*/
|
|
48
|
+
interactive?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Position of the gutter badge relative to the line content.
|
|
51
|
+
* - `'left'`: badge in a left margin gutter, outside the content area
|
|
52
|
+
* - `'right'`: badge floated to the right of the content (default)
|
|
53
|
+
*/
|
|
54
|
+
gutterPosition?: "left" | "right";
|
|
55
|
+
/**
|
|
56
|
+
* Whether to show the gutter badge on lines that have inline-highlighted
|
|
57
|
+
* comments (i.e. comments with `selected_text`). When false, lines where
|
|
58
|
+
* ALL comments have inline highlights will not get a gutter badge — the
|
|
59
|
+
* inline tooltip is the only way to view the comment. Default: true.
|
|
60
|
+
*/
|
|
61
|
+
gutterForInline?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to render inline text highlights for comments that have
|
|
64
|
+
* `selected_text`. When false, only gutter badges are shown.
|
|
65
|
+
* Default: true.
|
|
66
|
+
*/
|
|
67
|
+
inlineHighlights?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to add a `mrsf-line-highlight` CSS class on block elements
|
|
70
|
+
* that have comments. Provides a subtle visual tint on commented lines.
|
|
71
|
+
* Default: false.
|
|
72
|
+
*/
|
|
73
|
+
lineHighlight?: boolean;
|
|
74
|
+
/** Color scheme hint (default: 'auto'). */
|
|
75
|
+
theme?: "light" | "dark" | "auto";
|
|
76
|
+
/** Working directory for sidecar discovery (default: process.cwd()). */
|
|
77
|
+
cwd?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Slim comment shape used internally after loading. */
|
|
80
|
+
export interface SlimComment {
|
|
81
|
+
id: string;
|
|
82
|
+
author: string;
|
|
83
|
+
text: string;
|
|
84
|
+
line: number | null;
|
|
85
|
+
x_page: number | null;
|
|
86
|
+
end_line: number | null;
|
|
87
|
+
start_column: number | null;
|
|
88
|
+
end_column: number | null;
|
|
89
|
+
selected_text: string | null;
|
|
90
|
+
resolved: boolean;
|
|
91
|
+
reply_to: string | null;
|
|
92
|
+
severity: string | null;
|
|
93
|
+
type: string | null;
|
|
94
|
+
timestamp: string | null;
|
|
95
|
+
}
|
|
96
|
+
/** A root comment with its threaded replies. */
|
|
97
|
+
export interface CommentThread {
|
|
98
|
+
comment: SlimComment;
|
|
99
|
+
replies: SlimComment[];
|
|
100
|
+
}
|
|
101
|
+
/** Comments grouped by their anchored source line. */
|
|
102
|
+
export type LineMap = Map<number, CommentThread[]>;
|
|
103
|
+
/** A function that loads sidecar data from plugin options and render context. */
|
|
104
|
+
export type CommentLoader = (options: MrsfPluginOptions, env?: unknown) => MrsfDocument | null;
|
|
105
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mrsf/marp-mrsf",
|
|
3
|
+
"version": "0.4.8",
|
|
4
|
+
"description": "Marpit/Marp plugin for rendering Sidemark/MRSF review comments",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"browser": {
|
|
11
|
+
"import": "./dist/browser.js",
|
|
12
|
+
"types": "./dist/browser.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./browser": {
|
|
18
|
+
"import": "./dist/browser.js",
|
|
19
|
+
"types": "./dist/browser.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./style.css": "./dist/style.css",
|
|
22
|
+
"./controller": {
|
|
23
|
+
"import": "./dist/controller.js",
|
|
24
|
+
"types": "./dist/controller.d.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "node ../sync-types.mjs && node esbuild.config.mjs",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"test:watch": "vitest",
|
|
35
|
+
"lint": "tsc --noEmit",
|
|
36
|
+
"prepublishOnly": "cp ../../LICENSE . && npm run build && npm test",
|
|
37
|
+
"postpublish": "rm -f LICENSE"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"marp",
|
|
41
|
+
"marpit",
|
|
42
|
+
"markdown",
|
|
43
|
+
"review",
|
|
44
|
+
"sidecar",
|
|
45
|
+
"mrsf",
|
|
46
|
+
"sidemark",
|
|
47
|
+
"comments",
|
|
48
|
+
"annotation",
|
|
49
|
+
"rendering",
|
|
50
|
+
"presentation"
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"author": "Wictor Wilén (https://github.com/wictorwilen)",
|
|
54
|
+
"homepage": "https://github.com/wictorwilen/MRSF/tree/main/plugins/marp#readme",
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/wictorwilen/MRSF/issues"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/wictorwilen/MRSF.git",
|
|
61
|
+
"directory": "plugins/marp"
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist/**/*.js",
|
|
65
|
+
"dist/**/*.js.map",
|
|
66
|
+
"dist/**/*.d.ts",
|
|
67
|
+
"dist/style.css",
|
|
68
|
+
"README.md",
|
|
69
|
+
"LICENSE"
|
|
70
|
+
],
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@mrsf/cli": "^0.3.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@marp-team/marp-core": "^4.3.0",
|
|
76
|
+
"@marp-team/marpit": "^3.2.1",
|
|
77
|
+
"@mrsf/plugin-shared": "file:../shared",
|
|
78
|
+
"@types/markdown-it": "^14.1.2",
|
|
79
|
+
"@types/node": "^22.13.10",
|
|
80
|
+
"esbuild": "^0.27.3",
|
|
81
|
+
"markdown-it": "^14.1.0",
|
|
82
|
+
"typescript": "^5.8.2",
|
|
83
|
+
"vitest": "^3.0.9"
|
|
84
|
+
}
|
|
85
|
+
}
|