Skip to content

Comment splitting leads to problems #494

@jonchardy

Description

@jonchardy

As it stands, TypeDoc splits comments based on the first empty line within the docstring:

/**
 * Here's some documentation.
 *
 * Here's more detail.
 */

On our output, we get some useful splitting.

  • shortText: "Here's some documentation."
  • text: "Here's more detail."

Unfortunately, this can cause serious headaches when it's not wanted. Take this example:

/**
 * Here's some documentation with inline code:
 * ```js
 * var a = 0;
 *
 * console.log(a);
 * ```
 */

Now we end up with something much worse.

  • shortText: "Here's some documentation with inline code:\n```js\nvar a = 0;"
  • text: "console.log(a);\n```"

Of course, the parser would have to be way smarter to handle cases like this where the code markdown spans multiple lines, and I don't know how feasible that is. Maybe there could be an option where the text field would always contain the full comment text. That would make custom theming much simpler for those of us who want to handle things differently. Right now, it's hard to concatenate the comments since the lines end up trimmed.

I'm open for helping with this if someone can point me to an example where the JSON output is built differently based on some command-line option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions