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

Characters `<` and `>` are not being escaped using Docusarus 3. #502

Closed aamir1995 closed 2 months ago

aamir1995 commented 7 months ago

The following generated markdown will result in an error while using the plugin with Docusarus 3 and MDX 3.

> **new View**<`CameraControllerTypes`, `CameraControllerKind`>(
image

Probably need to escape these,

The issue can be reproduced by pasting the above problematic markdown in MDX Playground

This is also mentioned in upgrade guide of Docusarus V3 https://docusaurus.io/docs/migration/v3#common-mdx-problems

Environment Info: Docusarus version: 3.0.0 @mdx-js/react: 3.0.0 docusaurus-plugin-typedoc: 1.0.0-next.21 typedoc-plugin-frontmatter: 0.0.2 typedoc-plugin-markdown: 4.0.0-next.27

tgreyuk commented 7 months ago

Both opening and closing brackets should be escaped. Would you mind pasting in your source?

This looks like documentation of a class constructor but you should see this

> **new View**\<`CameraControllerTypes`, `CameraControllerKind`\>()
CoderIllusionist commented 7 months ago

@aamir1995 This plugin generates plain markdown files, docusaurus treats these (by default in V3) as mdx (which is not vanilla md) files. I had the exact same error you had, i fixed it by adding

  markdown: {
    format: 'detect'
  },

to docusaurus.config.ts. You can even test this in the MDX Playground link you provided by setting the input format to markdown

DominicGBauer commented 7 months ago

@CoderIllusionist thanks for the suggestion! I was having issues with using { } in a JS comment throwing an acorn error and using your suggestion fixed it.

maerzhase commented 4 months ago

@CoderIllusionist thanks man! this setting made my day :-)