Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] < in header not escaped when outputFormat: "markdown" #9719

Closed
bohyunjung opened this issue Feb 22, 2024 · 3 comments
Closed

[Bug] < in header not escaped when outputFormat: "markdown" #9719

bohyunjung opened this issue Feb 22, 2024 · 3 comments
Labels
bug A bug to fix

Comments

@bohyunjung
Copy link

Describe the bug

A rendered markdown file includes unescaped <.
And my markdown parser (docusaurus) fails to parse the file.

Here's a header line that includes unescaped <.

# <a id="Newtonsoft_Json_Generated_CustomBinding0_4"></a> Delegate CustomBinding0<TSelf, T0, T1, T2\>

To Reproduce
Steps to reproduce the behavior:

Run docfx with metadata.outputFormat: "markdown" option.

Whole docfx.json
{
  "metadata": [
    {
      "src": [
        {
          "src": "..",
          "files": [
            "**/*.cs"
          ]
        }
      ],
      "dest": "api",
      "globalNamespaceId": "Global",
      "allowCompilationErrors": true,
      "namespaceLayout": "nested",
      "outputFormat": "markdown"
    }
  ]
}

Expected behavior

Since > is escaped as follows, the escape of < is also expected.

CustomBinding0<TSelf, T0, T1, T2\>

Context (please complete the following information):

  • OS: macOS 14.2.1(23C71)
  • Docfx version: 2.75.3+a5c719410037cc288c7adff010b1abf3c0f2e581
  • Dotnet version: 7.0.403

Additional context

I'm working on a Unity package project, and I referenced the docfx settings of https://github.com/CaseyHofland/docfx-unitypackage.

@bohyunjung bohyunjung added the bug A bug to fix label Feb 22, 2024
@bohyunjung
Copy link
Author

bohyunjung commented Feb 22, 2024

I'm unsure whether this is relevant, but < is not included in EscapeChars. Is it intended? @yufeih

const string EscapeChars = "\\`*_{}[]()#+-!>~\"'";

@yufeih
Copy link
Contributor

yufeih commented Feb 22, 2024

< shows up correctly in your example using vscode markdown preview and it should comply with markdown standard. What markdown engine did you see problems rendering the content?

Screenshot 2024-02-22 at 8 45 01 PM

For context, escaping one angle bracket should prevent it from becoming an HTML tag, and > is used for blockquote syntax hence it is escape.

@bohyunjung
Copy link
Author

My bad. I was using the mdx parser in my docusaurus config. After setting it to md, it parses the docfx-generated markdown file without error.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix
Projects
None yet
Development

No branches or pull requests

2 participants