Skip to content

Commit 7e19045

Browse files
committed
chore: fix docs for find
1 parent 6199a9c commit 7e19045

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

apps/docs/document-api/reference/find.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Search the document for text or node matches using SDM/1 selectors.
2222

2323
## Expected result
2424

25-
Returns an SDFindResult envelope ({ total, limit, offset, items }). Each item is an SDNodeResult ({ node, address }).
25+
Returns an SDFindResult envelope (\{ total, limit, offset, items \}). Each item is an SDNodeResult (\{ node, address \}).
2626

2727
## Input fields
2828

packages/document-api/scripts/lib/reference-docs-artifacts.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ function yamlQuote(value: string): string {
7070
return value;
7171
}
7272

73+
/**
74+
* Escape MDX expression delimiters in plain prose so generated docs don't
75+
* evaluate `{ ... }` fragments as JavaScript at runtime.
76+
*/
77+
function escapeMdxText(value: string): string {
78+
return value.replace(/[{}]/gu, '\\$&');
79+
}
80+
7381
function renderList(values: readonly string[]): string {
7482
if (values.length === 0) return '- None';
7583
return values.map((value) => `- \`${value}\``).join('\n');
@@ -606,15 +614,17 @@ function renderOperationPage(operation: ContractOperationSnapshot, $defs: Defs):
606614
const title = operation.operationId;
607615
const metadata = operation.metadata;
608616
const description = OPERATION_DESCRIPTION_MAP[operation.operationId];
617+
const escapedDescription = escapeMdxText(description);
609618
const expectedResult = OPERATION_EXPECTED_RESULT_MAP[operation.operationId];
619+
const escapedExpectedResult = escapeMdxText(expectedResult);
610620

611621
const inputFields = renderFieldSections(operation.schemas.input, $defs);
612622
const outputFields = renderFieldSections(operation.schemas.output, $defs);
613623

614624
const inputExample = generateExample(operation.schemas.input, $defs);
615625
const outputExample = generateExample(operation.schemas.output, $defs);
616626
const stepOpsSection = renderStepOpsSection(operation);
617-
const expectedResultSection = `${expectedResult}${stepOpsSection ? `\n\n${stepOpsSection}` : ''}`;
627+
const expectedResultSection = `${escapedExpectedResult}${stepOpsSection ? `\n\n${stepOpsSection}` : ''}`;
618628

619629
// -- Build raw-schema accordion blocks --
620630
const rawSchemaBlocks: string[] = [];
@@ -639,7 +649,7 @@ ${GENERATED_MARKER}
639649
640650
## Summary
641651
642-
${description}
652+
${escapedDescription}
643653
644654
- Operation ID: \`${operation.operationId}\`
645655
- API member path: \`${formatMemberPath(operation.memberPath)}\`

0 commit comments

Comments
 (0)