Skip to content

JSDoc does not strip leading * inside markdown code block #23517

Closed

Description

@mjbvz

TypeScript Version: 2.9.0-dev.20180418

Search Terms:

  • jsdoc
  • example
  • markdown

Code

/**
 * @example
 * ```
 * 1 + 2
 * ```
*/
export function foo() { }

Hover over foo

Bug:
The jsdoc content returned includes the leading * from the comment inside the code block:

[Trace  - 11:08:38 AM] Response received: quickinfo (13). Request took 2 ms. Success: true 
Result: {
    "kind": "function",
    "kindModifiers": "export",
    "start": {
        "line": 9,
        "offset": 17
    },
    "end": {
        "line": 9,
        "offset": 20
    },
    "displayString": "function foo(): void",
    "documentation": "",
    "tags": [
        {
            "name": "example",
            "text": "```\n * 1 + 2\n * ```"
        }
]
}

This is a regression from the current 2.8 builds

Activity

  1. added this to the milestone on Apr 18, 2018
  2. mhegazy commented on Apr 18, 2018

    @mhegazy
    Contributor

    PRs welcomed.

  3. postspectacular commented on Aug 2, 2018

    @postspectacular

    I only noticed this change in behavior now after updating VSCode, but this definitely was still working correctly a couple of months ago. Also using standard (non-fenced / non-GFM) Markdown for code blocks still works correctly now. Maybe there was a change/replacement of the MD parser?

    /**
     * This works as expected (w/o leading asterisks)
     *
     * @example
     *
     *    const foo = [...mapcat((x) => [x,x,x], [1,2,3])];
     *    // [[1,1,1], [2,2,2], [3,3,3]]
     */
  4. JoelEinbinder commented on Jan 11, 2019

    @JoelEinbinder
    Contributor

    I bisected this one down to either b56093f or ab8233c

  5. added a commit that references this issue on Apr 10, 2019
  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions