Properly split by

in descriptions
This commit is contained in:
Ben C 2023-12-28 15:56:12 -05:00
parent b6702b46a7
commit f461592c78
No known key found for this signature in database
4 changed files with 1161 additions and 1824 deletions

View File

@ -12,18 +12,18 @@
"format": "prettier --write ." "format": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"@astrojs/starlight": "^0.14.0", "@astrojs/starlight": "^0.15.1",
"astro": "3.6.4", "astro": "4.0.8",
"rehype-external-links": "^3.0.0", "rehype-external-links": "^3.0.0",
"sharp": "^0.33.0" "sharp": "^0.33.1"
}, },
"devDependencies": { "devDependencies": {
"@apidevtools/json-schema-ref-parser": "^11.1.0", "@apidevtools/json-schema-ref-parser": "^11.1.0",
"eslint": "^8.54.0", "eslint": "^8.56.0",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.1.2",
"fast-xml-parser": "^4.3.2", "fast-xml-parser": "^4.3.2",
"prettier": "^3.1.0", "prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.2", "prettier-plugin-astro": "^0.12.3",
"xml-js": "^1.6.11" "xml-js": "^1.6.11"
} }
} }

2964
docs/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,8 @@ const refSlug = SchemaTools.getRefSlug(schema);
const enumVals = SchemaTools.getEnumValues(schema); const enumVals = SchemaTools.getEnumValues(schema);
const props = SchemaTools.getProps(schema, level); const props = SchemaTools.getProps(schema, level);
const descSplit = description?.toString().split("\n").map(l => l.trim()).filter(l => l.length !== 0);
const HeadingTag = levelMap[level] ?? "h6"; const HeadingTag = levelMap[level] ?? "h6";
--- ---
@ -60,7 +62,7 @@ const HeadingTag = levelMap[level] ?? "h6";
</div> </div>
) )
} }
{description ? <p>{description}</p> : <p>No Description Found</p>} {descSplit?.map(l => <p>{l}</p>) ?? <p>No Description Found</p>}
{ {
enumVals.length !== 0 && ( enumVals.length !== 0 && (
<> <>

View File

@ -2,7 +2,8 @@
import type { JSONSchema } from "@apidevtools/json-schema-ref-parser/dist/lib/types"; import type { JSONSchema } from "@apidevtools/json-schema-ref-parser/dist/lib/types";
import type { MarkdownHeading } from "astro"; import type { MarkdownHeading } from "astro";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { Element, xml2js } from "xml-js"; import { xml2js } from "xml-js";
import type { Element } from "xml-js";
export type InternalSchema = { type: "JSON"; val: JSONSchema } | { type: "XML"; val: Element }; export type InternalSchema = { type: "JSON"; val: JSONSchema } | { type: "XML"; val: Element };