JakubAndrysek / MkDoxy

📖 Automatically generates API documentation for your project based on Doxygen comments and code snippets in your markdown files.
https://mkdoxy.kubaandrysek.cz/
MIT License
60 stars 16 forks source link

Using the details tag #76

Open niosus opened 10 months ago

niosus commented 10 months ago

Hey there! Thanks for an amazing plugin!

I do have an issue with it though. I am trying to use the <details> tag with my generated docs and it fails on me.

If I use the following in my md file:

<details>
<summary>my_class</summary>

::: doxy.lidar.Class
    name: my_class
    indent_level: 4

</details>

This does not render in mkdocs generated page. It does generate without the details tag.

I do have all the needed extensions (I think) in my config:

markdown_extensions:
  - admonition
  - markdown.extensions.md_in_html
  - pymdownx.highlight
  - pymdownx.superfences
  - pymdownx.details
  - pymdownx.snippets:
      check_paths: true
  - toc:
      permalink: true
  - pymdownx.blocks.details:
  - pymdownx.blocks.html:
  - pymdownx.blocks.definition:
  - pymdownx.blocks.tab:
  - pymdownx.tabbed:
      alternate_style: true

Any ideas what I might be doing wrong?

JakubAndrysek commented 10 months ago

Look at new branch https://github.com/JakubAndrysek/MkDoxy/tree/details-tag

niosus commented 10 months ago

Thanks for doing this! I did try it already with the indent level but it still does not work for me. Does it work also with the class for you?

In my example, I am getting the code blocks rendered correctly but all the rest of the markdown is not rendered within the details tag:

<details>
<summary>MyClass</summary>

::: doxy.lidar.Class
  name: MyClass
  indent_level: 4

</details>

The result looks something like this. Screenshot 2023-09-04 at 10 04 57

Do you have any further ideas on what I might be missing here?

niosus commented 10 months ago

Ooooh, I found it. Maybe you'd like to also include it in the example that you provided in the branch that you linked above. I need to add the markdown attribute to the details tag like so:

<details markdown>
<summary>MyClass</summary>

::: doxy.lidar.Class
  name: MyClass
  indent_level: 4

</details>

This renders correctly for me.

I will keep this issue open for now for visibility so that you can add this to the example if you wish, but feel free to close this as you see fit. Thanks again for your help and your work!

JakubAndrysek commented 10 months ago

Thank you for your research. I will add this info to the docs.

JakubAndrysek commented 10 months ago

I have tried your recommended option with "markdown" tag and it fixed it only partially. Everything is rendered successfully, but the header stays as MD tag. Have you found any result to fix that? Or is it just my problem?

image

## Add MkDoxy tag into the `<details>` tag
If you want to add MkDoxy tag into the `<details>` tag, you can use the `details` option.
In some cases, it might be tricky to configure indentation, so you can use the `indent_level` option to indent generated markdown block.

<details markdown="1">
<summary>my_class</summary>

::: doxy.animal.file.list
indent_level: 2

</details>
JakubAndrysek commented 10 months ago

If you find something, I will be very appreciative if you finish the PR https://github.com/JakubAndrysek/MkDoxy/tree/details-tag.

Thanks, Jacob

niosus commented 10 months ago

Strange, in my case I can see a fully rendered markdown. 🤷