docs: handle Card and CardList components in cross-links plugin (#7338)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { UnistNodeWithData } from "../types/index.js"
|
||||
|
||||
export default function getAttribute(
|
||||
node: UnistNodeWithData,
|
||||
attrName: string
|
||||
) {
|
||||
const attributeIndex = node.attributes?.findIndex(
|
||||
(attribute) => attribute.name === attrName
|
||||
)
|
||||
if (attributeIndex === undefined || attributeIndex === -1) {
|
||||
return
|
||||
}
|
||||
const attribute = node.attributes![attributeIndex]
|
||||
|
||||
if (!attribute) {
|
||||
return
|
||||
}
|
||||
|
||||
return attribute
|
||||
}
|
||||
Reference in New Issue
Block a user