Skip to content

Commit 4087bd0

Browse files
authored
DOP-6596: Omissions in md (#1602)
1 parent 0c98654 commit 4087bd0

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/utils/snooty-ast-to-md/snooty-ast-to-md.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ const renderAst = (node, state) => {
143143
}
144144
return node.children.map((subnode) => renderAst(subnode, { ...state })).join('');
145145

146+
case 'definitionListItem':
147+
const term = node.term.map((subnode) => renderAst(subnode, { ...state })).join('');
148+
const definition = node.children.map((subnode) => renderAst(subnode, { ...state })).join('');
149+
return `${term} - ${definition}\n\n`;
150+
146151
default:
147152
return node.children.map((subnode) => renderAst(subnode, { ...state })).join('');
148153
}
@@ -171,6 +176,13 @@ const renderDirective = (node, state) => {
171176
case 'tabs':
172177
case 'tabs-drivers':
173178
return `\n\n<Tabs>\n\n${node.children.map((child) => renderAst(child, { ...state })).join('')}\n\n</Tabs>\n\n`;
179+
180+
case 'collapsible':
181+
const heading = node.options?.heading;
182+
const subHeading = node.options?.sub_heading;
183+
const children = node.children.map((subnode) => renderAst(subnode, { ...state })).join('');
184+
return `${heading}\n\n${subHeading}\n\n${children}`;
185+
174186
default:
175187
return node.children.map((subnode) => renderAst(subnode, { ...state })).join('');
176188
}

tests/utils/snooty-ast-to-md.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,27 @@ For additional patterns and use cases, see also: [Building with Patterns](https:
9696
9797
The following documents provide overviews of various data modeling patterns and common schema design considerations:
9898
99-
Examples for modeling relationships between documents.
99+
[Model Relationships Between Documents](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/applications/data-models-relationships/) - Examples for modeling relationships between documents.
100100
101-
Presents a data model that uses [embedded documents](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-embedding) to describe one-to-one relationships between connected data.
101+
[Model One-to-One Relationships with Embedded Documents](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-embedded-one-to-one-relationships-between-documents/) - Presents a data model that uses [embedded documents](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-embedding) to describe one-to-one relationships between connected data.
102102
103-
Presents a data model that uses [embedded documents](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-embedding) to describe one-to-many relationships between connected data.
103+
[Model One-to-Many Relationships with Embedded Documents](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-embedded-one-to-many-relationships-between-documents/) - Presents a data model that uses [embedded documents](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-embedding) to describe one-to-many relationships between connected data.
104104
105-
Presents a data model that uses [references](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-referencing) to describe one-to-many relationships between documents.
105+
[Model One-to-Many Relationships with Document References](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-referenced-one-to-many-relationships-between-documents/) - Presents a data model that uses [references](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-referencing) to describe one-to-many relationships between documents.
106106
107-
Examples for modeling tree structures.
107+
[Model Tree Structures](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/applications/data-models-tree-structures/) - Examples for modeling tree structures.
108108
109-
Presents a data model that organizes documents in a tree-like structure by storing [references](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-referencing) to "parent" nodes in "child" nodes.
109+
[Model Tree Structures with Parent References](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-tree-structures-with-parent-references/) - Presents a data model that organizes documents in a tree-like structure by storing [references](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-referencing) to "parent" nodes in "child" nodes.
110110
111-
Presents a data model that organizes documents in a tree-like structure by storing [references](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-referencing) to "child" nodes in "parent" nodes.
111+
[Model Tree Structures with Child References](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-tree-structures-with-child-references/) - Presents a data model that organizes documents in a tree-like structure by storing [references](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/core/data-model-design/#std-label-data-modeling-referencing) to "child" nodes in "parent" nodes.
112112
113113
See [Model Tree Structures](https://mongodbcom-cdn.staging.corp.mongodb.com/${siteBasePrefix}/applications/data-models-tree-structures/) for additional examples of data models for tree structures.
114114
115-
Examples for models for specific application contexts.
115+
[Model Specific Application Contexts](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/applications/data-models-applications/) - Examples for models for specific application contexts.
116116
117-
Illustrates how embedding fields related to an atomic update within the same document ensures that the fields are in sync.
117+
[Model Data for Atomic Operations](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-data-for-atomic-operations/) - Illustrates how embedding fields related to an atomic update within the same document ensures that the fields are in sync.
118118
119-
Describes one method for supporting keyword search by storing keywords in an array in the same document as the text field. Combined with a multi-key index, this pattern can support application's keyword search operations.
119+
[Model Data to Support Keyword Search](https://mongodbcom-cdn.staging.corp.mongodb.com/docs/example-project/tutorial/model-data-for-keyword-search/) - Describes one method for supporting keyword search by storing keywords in an array in the same document as the text field. Combined with a multi-key index, this pattern can support application's keyword search operations.
120120
121121
`;
122122
expect(result).toBe(expected);

0 commit comments

Comments
 (0)