Skip to content

Commit f8f9bab

Browse files
committed
feat: render section as opposed to string[]
1 parent 1970145 commit f8f9bab

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ npm-debug.log
77
/.idea/
88
/dist/
99
/lib/
10+
.sfdx/

src/core/markdown/adapters/type-to-renderable.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,13 @@ function fieldMetadataToRenderable(
281281
description: field.description ? [field.description] : [],
282282
apiName: getApiName(field.name, config),
283283
fieldType: field.type,
284-
pickListValues: field.pickListValues
284+
isPicklist: field.pickListValues.length > 0,
285+
pickListValues: {
286+
headingLevel: headingLevel + 1,
287+
heading: 'Possible values are',
288+
value: field.pickListValues
289+
290+
}
285291
};
286292
}
287293

src/core/markdown/templates/custom-object-template.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ export const customObjectTemplate = `
2323
**Type**
2424
2525
*{{fieldType}}*
26-
{{#each pickListValues}}
27-
* {{this}}
28-
{{/each}}
26+
27+
{{#if isPicklist}}
28+
{{ heading headingLevel heading }}
29+
{{#each pickListValues.value}}
30+
* {{{this}}}
31+
{{/each}}
32+
{{/if}}
2933
{{/if}}
3034
3135
{{#unless @last}}---{{/unless}}

src/core/renderables/types.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ export type RenderableCustomField = {
189189
heading: string;
190190
apiName: string;
191191
description: RenderableContent[];
192-
pickListValues: string[];
192+
isPicklist: boolean;
193+
pickListValues?: RenderableSection<string[]>
193194
type: 'field';
194195
fieldType?: string | null;
195196
};

0 commit comments

Comments
 (0)