NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
453 stars 102 forks source link

How to avoid the HTML escape characters in the code blocks? #226

Closed skzhang1 closed 2 years ago

skzhang1 commented 2 years ago

Environment

Describe the bug I want to generate the code block from the annotations.

class cool_class():
    """cool!"""

    def __init__(
        self,
        cool_member
    ):
        """
        # Arguments
            cool_member: a cool guy

            ```python
                print("cool!")
    """
def cool_function(self):
    print("cool!")

But the markdown file I generate is
class cool_class()

cool!

__init__

def __init__(cool_member)

Arguments

My config is 

loaders:

Replace &quot with ". I do not need any escape characters.

Look forward to your reply. Thanks!

NiklasRosenstein commented 2 years ago

Hello @Shao-kun-Zhang ,

Have you tried turning off the escape_html_in_docstring option that is enabled by default for the Markdown renderer used in the Docusaraus renderer?

https://github.com/NiklasRosenstein/pydoc-markdown/blob/f8436b3df0445f342b2f745ebe7ea379d66a5150/src/pydoc_markdown/contrib/renderers/docusaurus.py#L28

That would go

renderer:
  type: docusaurus
  # ...
  markdown:
    escape_html_in_docstring: false

Let me know if that works for you!

skzhang1 commented 2 years ago

It works! Thanks for your help! I am very appreciate it. (I remember I have tried before, but it didn't work before. @NiklasRosenstein