@@ -6,7 +6,12 @@ import { SKIP, visit } from 'unist-util-visit';
66
77import buildExtraContent from './buildExtraContent.mjs' ;
88import { DOC_NODE_BLOB_BASE_URL } from '../../../constants.mjs' ;
9- import createQueries from '../../../utils/queries/index.mjs' ;
9+ import { LINKS_WITH_TYPES } from '../../../utils/queries/regex.mjs' ;
10+ import {
11+ isHeading ,
12+ isHtmlWithType ,
13+ isStabilityNode ,
14+ } from '../../../utils/queries/unist.mjs' ;
1015
1116/**
1217 * Builds a Markdown heading for a given node
@@ -71,7 +76,7 @@ const buildStability = ({ children, data }, index, parent) => {
7176 */
7277const buildHtmlTypeLink = node => {
7378 node . value = node . value . replace (
74- createQueries . QUERIES . linksWithTypes ,
79+ LINKS_WITH_TYPES ,
7580 ( _ , type , link ) => `<a href="${ link } " class="type"><${ type } ></a>`
7681 ) ;
7782} ;
@@ -223,16 +228,16 @@ export default (headNodes, metadataEntries, remark) => {
223228 const content = structuredClone ( entry . content ) ;
224229
225230 // Parses the Heading nodes into Heading elements
226- visit ( content , createQueries . UNIST . isHeading , buildHeading ) ;
231+ visit ( content , isHeading , buildHeading ) ;
227232
228233 // Parses the Blockquotes into Stability elements
229234 // This is treated differently as we want to preserve the position of a Stability Index
230235 // within the content, so we can't just remove it and append it to the metadata
231- visit ( content , createQueries . UNIST . isStabilityNode , buildStability ) ;
236+ visit ( content , isStabilityNode , buildStability ) ;
232237
233238 // Parses the type references that got replaced into Markdown links (raw)
234239 // into actual HTML links, these then get parsed into HAST nodes on `runSync`
235- visit ( content , createQueries . UNIST . isHtmlWithType , buildHtmlTypeLink ) ;
240+ visit ( content , isHtmlWithType , buildHtmlTypeLink ) ;
236241
237242 // Splits the content into the Heading node and the rest of the content
238243 const [ headingNode , ...restNodes ] = content . children ;
0 commit comments