Skip to content

Commit e94ca85

Browse files
committed
hotfix: yaml parsing
1 parent 0d7127e commit e94ca85

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/queries.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const createQueries = () => {
2828
const addYAMLMetadata = (node, apiEntryMetadata) => {
2929
const sanitizedString = node.value.replace(
3030
createQueries.QUERIES.yamlInnerContent,
31-
(_, __, inner) => inner
31+
// Either capture a YAML multinline block, or a simple single-line YAML block
32+
(_, simple, yaml) => simple || yaml
3233
);
3334

3435
apiEntryMetadata.updateProperties(parseYAMLIntoMetadata(sanitizedString));
@@ -175,13 +176,13 @@ createQueries.QUERIES = {
175176
normalizeTypes: /(\{|<)(?! )[a-zA-Z0-9.| \[\]\\]+(?! )(\}|>)/g,
176177
// ReGex to match the type API type references that got already parsed
177178
// so that they can be transformed into HTML links
178-
linksWithTypes: /\[`<([a-zA-Z0-9.| \\[\]]+)>`\]\((.*)\)/,
179+
linksWithTypes: /\[`<([a-zA-Z0-9.| \\[\]]+)>`\]\((\S+)\)/g,
179180
// ReGeX for handling Stability Indexes Metadata
180181
stabilityIndex: /^Stability: ([0-5])(?:\s*-\s*)?(.*)$/s,
181182
// ReGeX for handling the Stability Index Prefix
182183
stabilityIndexPrefix: /Stability: ([0-5])/,
183184
// ReGeX for retrieving the inner content from a YAML block
184-
yamlInnerContent: /^<!--(YAML| YAML)?([\s\S]*?)-->/,
185+
yamlInnerContent: /^<!--[ ]?(?:YAML([\s\S]*?)|([ \S]*?))?[ ]?-->/,
185186
};
186187

187188
createQueries.UNIST = {

0 commit comments

Comments
 (0)