-
-
Notifications
You must be signed in to change notification settings - Fork 370
Closed
syntax-tree/mdast-util-from-markdown
#25Labels
💪 phase/solvedPost is donePost is done
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
Link to runnable example
No response
Steps to reproduce
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
const u = unified()
const input = '[`foo`][]\n\n[`foo`]: http://example.com/'
const ast = u()
.use(remarkParse)
.parse(input)
const output = u()
.use(remarkStringify)
.stringify(ast)
if (input !== output) {
console.log(`INPUT: ${input}`)
console.log(`OUTPUT: ${output}`)
console.log(`AST: ${JSON.stringify(ast, null, 1)}`)
}
Expected behavior
I would expect the link on the first line of the input/output to either be left as it is in the input, or else converted to [`foo`][`foo`]
.
Actual behavior
The output breaks the reference link on the first line by changing it from [`foo`][]
to [`foo`][foo]
.
Runtime
Node v16
Package manager
npm v7
OS
macOS
Build and bundle tools
No response
Metadata
Metadata
Assignees
Labels
💪 phase/solvedPost is donePost is done