@tsdoctor/model 0.2.0 → 0.2.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/internal/prose.js +7 -9
- package/package.json +3 -3
package/internal/prose.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { Markdown,
|
|
1
|
+
import { Markdown, Text } from "@effected/markdown";
|
|
2
2
|
import { Result } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/prose.ts
|
|
5
5
|
/**
|
|
6
|
-
* Parse a single-line markdown prose string into phrasing nodes.
|
|
7
|
-
*
|
|
8
|
-
* whitespace-normalized single-line text). Falls back to a
|
|
9
|
-
* when the string does not parse.
|
|
6
|
+
* Parse a single-line markdown prose string into phrasing nodes. The whole
|
|
7
|
+
* input is treated as one paragraph's inline content (prose from TSDoc
|
|
8
|
+
* extraction is whitespace-normalized single-line text). Falls back to a
|
|
9
|
+
* literal Text node when the string does not parse.
|
|
10
10
|
*/
|
|
11
11
|
const phrasingFromMarkdown = (prose) => {
|
|
12
|
-
const parsed = Markdown.
|
|
12
|
+
const parsed = Markdown.parsePhrasingResult(prose);
|
|
13
13
|
if (Result.isFailure(parsed)) return [new Text({ value: prose })];
|
|
14
|
-
|
|
15
|
-
for (const child of parsed.success.children) if (child instanceof Paragraph) phrasing.push(...child.children);
|
|
16
|
-
return phrasing.length > 0 ? phrasing : [new Text({ value: prose })];
|
|
14
|
+
return parsed.success.length > 0 ? parsed.success : [new Text({ value: prose })];
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsdoctor/model",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Render Microsoft API Extractor models into LLM-lean markdown. Pure model loading, TSDoc extraction, type-signature formatting, and per-item markdown rendering.",
|
|
6
6
|
"keywords": [
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@microsoft/tsdoc": "^0.16.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@effected/markdown": "^0.
|
|
46
|
-
"@effected/package-json": "^0.
|
|
45
|
+
"@effected/markdown": "^0.7.0",
|
|
46
|
+
"@effected/package-json": "^0.12.0",
|
|
47
47
|
"effect": "4.0.0-rc.109"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|