typedoc2md / typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
https://typedoc-plugin-markdown.org
MIT License
689 stars 172 forks source link

`sanitizeComments` doesn't add escape characters in front of `<` characters in JSDoc comments #612

Closed JosephDenman closed 1 month ago

JosephDenman commented 1 month ago

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

I have a comment in a d.ts file in my project that reads:

/**
 * There are different *classes* of state values:
 *
 * - `null`
 * - Cells of {@link AlignedValue}s
 * - Maps from {@link AlignedValue}s to state values
 * - Bounded Merkle trees containing {@link AlignedValue} leaves
 * - Short (<= 15 element) arrays of state values
 *
 * State values are *immutable*, any operations that mutate states will return
 * a new state instead.
 */

My package.json file looks like this:

  "devDependencies": {
    "typedoc": "^0.25.2",
    "typedoc-plugin-markdown": "^4.0.1"
  }

The output of running typedoc with the above configuration is processed by Docusaurus. The problem we're having is that Docusaurus interpreters < characters as the beginning of HTML tags.

TypeDoc configuration

{
  "name": "name of my project",
  "out": "path to documentation out directory",
  "plugin": ["typedoc-plugin-markdown"],
  "entryPoints": ["path to d.ts file"],
  "hideGenerator": true,
  "disableSources": true,
  "excludeExternals": false,
  "visibilityFilters": {
    "external": true
  },
  "sanitizeComments": true,
  "includeVersion": true,
  "useCodeBlocks": true,
  "expandObjects": true
}

Expected behavior

Adding sanitizeComments: true should add an escape \ character in front of the < character, but it doesn't.

tgreyuk commented 1 month ago

Thank you. Fixed in typedoc-plugin-markdown@4.0.2.

JosephDenman commented 1 month ago

Thank you!