From 5d8d4504d52a5bb0a0432bf399bbd82d9e5ea7fc Mon Sep 17 00:00:00 2001 From: Anton Shchekota Date: Wed, 7 Apr 2021 15:28:32 +0300 Subject: [PATCH] fix: @see tags incorrectly formatted in markdown ouput fixed #1337 --- __tests__/__snapshots__/test.js.snap | 17 +++++++++++++---- src/output/markdown_ast.js | 13 +++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 56200d8..6fb4aa1 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -27337,8 +27337,8 @@ exports[`outputs meta.input.js markdown 1`] = ` ## meta.input -- **See: [markdown link][2] - ** +- **See**: [markdown link][2] + This function returns the number one. @@ -27383,9 +27383,18 @@ Object { "children": Array [ Object { "children": Array [ + Object { + "children": Array [ + Object { + "type": "text", + "value": "See", + }, + ], + "type": "strong", + }, Object { "type": "text", - "value": "See: ", + "value": ": ", }, Object { "children": Array [ @@ -27447,7 +27456,7 @@ Object { "type": "root", }, ], - "type": "strong", + "type": "paragraph", }, ], "type": "listItem", diff --git a/src/output/markdown_ast.js b/src/output/markdown_ast.js index 4893566..ce97ffe 100644 --- a/src/output/markdown_ast.js +++ b/src/output/markdown_ast.js @@ -223,15 +223,20 @@ function buildMarkdownAST(comments, config) { ); } - function seeLink(comment) { + function seeLink({ sees = [] }) { return ( - comment.sees.length > 0 && + sees.length > 0 && u( 'list', { ordered: false }, - comment.sees.map(see => + sees.map(see => u('listItem', [ - u('strong', [u('text', 'See: ')].concat(see.description)) + u( + 'paragraph', + [u('strong', [u('text', 'See')]), u('text', ': ')].concat( + see.description + ) + ) ]) ) )