Skip to content

Commit

Permalink
fix: link definition
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Apr 1, 2022
1 parent d59e692 commit de27bd7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/descriptionFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function formatDescription(
return `[${stringyfy(ast, intention, mdAst)}][${ast.label}]`;
}
case "definition": {
return `\n\n[${ast.label}]: [${ast.url}]`;
return `\n\n[${ast.label}]: ${ast.url}`;
}

case "blockquote": {
Expand Down
18 changes: 16 additions & 2 deletions tests/__snapshots__/descriptions.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,25 @@ exports[`Reference-style Links 1`] = `
*
* See [documentation][1] for more details.
*
* [1]: [https://www.documentation.com]
* [1]: https://www.documentation.com
*/
"
`;
exports[`Reference-style Links 2`] = `
"/**
* This is a [link][1] test.
*
* [1]: https://www.google.com/
*
* @param value - Any value you want to test is a number.
*/
function test(value) {
return true;
}
"
`;
exports[`code in description 1`] = `
"/**
* \`Touchable\`: Taps done right.
Expand Down Expand Up @@ -768,7 +782,7 @@ exports[`matches prettier markdown format 1`] = `
* - With a [link] (/to/somewhere)
* - And [another one][another one]
*
* [another one]: [http://example.com]
* [another one]: http://example.com
*
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
* consectetur maximus risus, sed maximus tellus tincidunt et.
Expand Down
15 changes: 15 additions & 0 deletions tests/descriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,4 +1016,19 @@ test("Reference-style Links ", () => {
`);

expect(result).toMatchSnapshot();

const result2 = subject(`
/**
* This is a [link][1] test.
*
* [1]: https://www.google.com/
*
* @param value - Any value you want to test is a number.
*/
function test(value) {
return true
}
`);

expect(result2).toMatchSnapshot();
});

0 comments on commit de27bd7

Please sign in to comment.