typedoc-plugin-markdown icon indicating copy to clipboard operation
typedoc-plugin-markdown copied to clipboard

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

Open aamir1995 opened this issue 1 year ago • 4 comments

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

aamir1995 avatar Nov 17 '23 16:11 aamir1995

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`\>()

tgreyuk avatar Nov 17 '23 22:11 tgreyuk

@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

CoderIllusionist avatar Nov 27 '23 15:11 CoderIllusionist

@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.

DominicGBauer avatar Nov 29 '23 09:11 DominicGBauer

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

maerzhase avatar Feb 16 '24 09:02 maerzhase