33import { u as createTree } from 'unist-builder' ;
44import { SKIP } from 'unist-util-visit' ;
55
6- import { DOC_API_STABILITY_SECTION_REF_URL } from './constants.mjs' ;
6+ import {
7+ DOC_API_STABILITY_SECTION_REF_URL ,
8+ VALID_JAVASCRIPT_PROPERTY ,
9+ } from './constants.mjs' ;
710import {
811 extractYamlContent ,
912 parseHeadingIntoMetadata ,
@@ -278,15 +281,15 @@ createQueries.UNIST = {
278281 const [ node , ...contentNodes ] =
279282 list ?. children ?. [ 0 ] ?. children ?. [ 0 ] ?. children ?? [ ] ;
280283
281- // Exit if no content nodes
282- if ( ! node ) {
284+ const possibleProperty = node ?. value ?. trimStart ( ) ;
285+
286+ // Exit if no content in node (or if no node exists)
287+ if ( ! possibleProperty ) {
283288 return false ;
284289 }
285290
286291 // Check for other starters
287- if (
288- node . value ?. trimStart ( ) . match ( createQueries . QUERIES . typedListStarters )
289- ) {
292+ if ( possibleProperty . match ( createQueries . QUERIES . typedListStarters ) ) {
290293 return true ;
291294 }
292295
@@ -298,7 +301,8 @@ createQueries.UNIST = {
298301 // Check for inline code + space + type link pattern
299302 if (
300303 node . type === 'inlineCode' &&
301- contentNodes [ 0 ] ?. value . trim ( ) === '' &&
304+ possibleProperty . match ( VALID_JAVASCRIPT_PROPERTY ) &&
305+ contentNodes [ 0 ] ?. value ?. trim ( ) === '' &&
302306 contentNodes [ 1 ] ?. type === 'link' &&
303307 contentNodes [ 1 ] ?. children ?. [ 0 ] ?. value ?. [ 0 ] === '<'
304308 ) {
0 commit comments