fix(md): correctly append feedback on linked headings

This commit is contained in:
rhld16 2025-01-19 15:28:50 +00:00
parent 6d6b4abe9f
commit af5bf1a445
No known key found for this signature in database
GPG key ID: FE0DB0AECB31CB8E

View file

@ -40,7 +40,7 @@ export const headersPlugin = (md: MarkdownRenderer) => {
// //
// The token after `heading_open` contains the link as a child token. // The token after `heading_open` contains the link as a child token.
const children = tokens[idx + 1].children || [] const children = tokens[idx + 1].children || []
const linkOpenToken = children.find((c) => c.type === 'link_open') const linkOpenToken = children.findLast((c) => c.type === 'link_open')
if (!linkOpenToken) return result if (!linkOpenToken) return result
const heading = tokens[idxClose - 1] const heading = tokens[idxClose - 1]