@wgtechlabs/mdd-engine 0.1.0-pr.55ddedf → 0.1.0-pr.8fa2dc9

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
@@ -133,20 +133,6 @@ Use GitHub-style alerts with `NOTE`, `TIP`, `IMPORTANT`, `WARNING`, or `CAUTION`
133
133
 
134
134
  `:::details[More information]` remains supported and becomes `details`/`summary`; its label is optional, attributes are errors, and its readable Markdown uses a blockquote with a bold label. The old `:::note`, `:::tip`, and `:::warning` directives now fail with a `REMOVED_COMPONENT` migration diagnostic. See [alerts and migration](docs/ALERTS.md) for all five types, theme hooks, and how to preserve custom titles and bodies.
135
135
 
136
- Document an API endpoint with a leaf directive, then use ordinary Markdown for parameters and request/response examples:
137
-
138
- ```markdown
139
- ## Retrieve a widget
140
-
141
- ::endpoint{method="GET" path="/v1/widgets/{id}"}
142
-
143
- | Parameter | Type | Description |
144
- | --- | --- | --- |
145
- | `id` | string | Widget identifier. |
146
- ```
147
-
148
- The required `method` accepts GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE, or CONNECT, normalizing lowercase/mixed case to uppercase. The required `path` starts with a single `/` and contains no whitespace or control characters; braces and query punctuation remain literal text. Labels, extra attributes, and inline/container forms are errors. The engine emits a `div.mdd-endpoint` containing `strong.mdd-endpoint-method.mdd-method-get` (or the corresponding lowercase method) and `code.mdd-endpoint-path`. Normalized Markdown contains `**GET**` followed by the code-formatted path, so the signature stays readable and searchable. Endpoint paths are not rewritten with the documentation base path. This is documentation only: no HTTP requests run. MDD and its themes provide presentation.
149
-
150
136
  Title precedence is frontmatter title, first H1, then readable filename. Navigation uses `navTitle` when supplied. Explicit `order` sorts first; remaining siblings sort deterministically by label and path.
151
137
 
152
138
  Local `.md` links, extensionless routes, reference links, and images resolve from their source document. A leading slash addresses the documentation root. `basePath` prefixes public links, including `/docs/` and `/repository/docs/`. When a file-style URL matches both an existing supported asset and a page route, the asset wins: `chart.png` selects the image, while `/chart.png/` explicitly selects the page. If no regular asset exists, dotted page routes still resolve. External links are preserved without network requests. Headings have `mdd-`-prefixed GitHub-style slugs; author links such as `#installation` are rewritten to `#mdd-installation`. Duplicate headings receive `-1`, `-2`, and subsequent suffixes.
package/dist/markdown.js CHANGED
@@ -13,7 +13,6 @@ import { unified } from "unified";
13
13
  import { SKIP, visit } from "unist-util-visit";
14
14
  import { parseDocument as parseYaml } from "yaml";
15
15
  import { transformAlerts } from "./alerts.js";
16
- import { endpointParagraph } from "./endpoints.js";
17
16
  const parser = unified()
18
17
  .use(remarkParse)
19
18
  .use(remarkGfm)
@@ -30,20 +29,10 @@ const htmlRenderer = unified()
30
29
  ...defaultSchema.attributes,
31
30
  aside: [["className", /^mdd-/]],
32
31
  details: [["className", "mdd-details"]],
33
- div: [["className", "mdd-endpoint"]],
34
32
  p: [
35
33
  ...(defaultSchema.attributes?.p ?? []),
36
34
  ["className", "mdd-component-label"],
37
35
  ],
38
- strong: [
39
- ...(defaultSchema.attributes?.strong ?? []),
40
- [
41
- "className",
42
- "mdd-endpoint-method",
43
- /^mdd-method-(get|head|post|put|patch|delete|options|trace|connect)$/,
44
- ],
45
- ],
46
- code: [["className", /^language-./, "mdd-endpoint-path"]],
47
36
  summary: [
48
37
  ...(defaultSchema.attributes?.summary ?? []),
49
38
  ["className", "mdd-component-label"],
@@ -217,16 +206,8 @@ export function parseDocument(source, file, diagnostics) {
217
206
  report("REMOVED_COMPONENT", `The ${node.name} directive was removed; use > [!${node.name.toUpperCase()}] followed by quoted body lines. Keep any optional custom title as bold text in the alert body.`, node);
218
207
  return;
219
208
  }
220
- if (node.name === "endpoint") {
221
- const paragraph = endpointParagraph(node, source, (message) => report("INVALID_COMPONENT", message, node));
222
- if (paragraph && parent && index !== undefined) {
223
- parent.children[index] = paragraph;
224
- return [SKIP, index];
225
- }
226
- return;
227
- }
228
209
  if (node.type !== "containerDirective" || node.name !== "details") {
229
- report("UNKNOWN_COMPONENT", `Unsupported component ${node.name}; use a GitHub alert, details container, or endpoint leaf.`, node);
210
+ report("UNKNOWN_COMPONENT", `Unsupported component ${node.name}; use a GitHub alert or a details container.`, node);
230
211
  return;
231
212
  }
232
213
  if (Object.keys(node.attributes ?? {}).length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wgtechlabs/mdd-engine",
3
- "version": "0.1.0-pr.55ddedf",
3
+ "version": "0.1.0-pr.8fa2dc9",
4
4
  "description": "Headless Markdown documentation compiler for mdd",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,3 +0,0 @@
1
- import type { Nodes, Paragraph } from "mdast";
2
- /** Endpoint signatures are documentation text, never links or executable requests. */
3
- export declare function endpointParagraph(node: Nodes, source: string, report: (message: string) => void): Paragraph | undefined;
package/dist/endpoints.js DELETED
@@ -1,68 +0,0 @@
1
- const methods = new Set([
2
- "GET",
3
- "HEAD",
4
- "POST",
5
- "PUT",
6
- "PATCH",
7
- "DELETE",
8
- "OPTIONS",
9
- "TRACE",
10
- "CONNECT",
11
- ]);
12
- /** Endpoint signatures are documentation text, never links or executable requests. */
13
- export function endpointParagraph(node, source, report) {
14
- if (node.type !== "leafDirective") {
15
- report('Use the leaf form ::endpoint{method="GET" path="/example"}.');
16
- return;
17
- }
18
- const offset = node.position?.start.offset;
19
- if (node.children.length ||
20
- (offset !== undefined && source.startsWith("::endpoint[", offset))) {
21
- report("The endpoint component does not support a label.");
22
- return;
23
- }
24
- const attributes = node.attributes ?? {};
25
- if (Object.keys(attributes).some((key) => key !== "method" && key !== "path")) {
26
- report("The endpoint component supports only method and path attributes.");
27
- return;
28
- }
29
- const method = (attributes.method ?? "").toUpperCase();
30
- if (!methods.has(method)) {
31
- report("The endpoint method must be GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE, or CONNECT.");
32
- return;
33
- }
34
- const path = attributes.path ?? "";
35
- if (!path.startsWith("/") ||
36
- path.startsWith("//") ||
37
- // biome-ignore lint/suspicious/noControlCharactersInRegex: Endpoint text cannot contain invisible controls or whitespace.
38
- /[\s\u0000-\u001f\u007f-\u009f]/u.test(path)) {
39
- report("The endpoint path must start with a single / and contain no whitespace or control characters.");
40
- return;
41
- }
42
- return {
43
- type: "paragraph",
44
- position: node.position,
45
- // Tight lists unwrap ordinary paragraphs; retain the signature's block hook.
46
- data: { hName: "div", hProperties: { className: ["mdd-endpoint"] } },
47
- children: [
48
- {
49
- type: "strong",
50
- data: {
51
- hProperties: {
52
- className: [
53
- "mdd-endpoint-method",
54
- `mdd-method-${method.toLowerCase()}`,
55
- ],
56
- },
57
- },
58
- children: [{ type: "text", value: method }],
59
- },
60
- { type: "text", value: " " },
61
- {
62
- type: "inlineCode",
63
- value: path,
64
- data: { hProperties: { className: ["mdd-endpoint-path"] } },
65
- },
66
- ],
67
- };
68
- }