mkdocs / mkdocs-click

An MkDocs extension to generate documentation for Click command line applications
https://pypi.org/project/mkdocs-click
Apache License 2.0
112 stars 16 forks source link

Documentation only renders when there are at least two spaces at the end of .md file #50

Closed ieaves closed 1 year ago

ieaves commented 2 years ago

I'm a new user to mkdocs-click so apologies if I'm doing something wrong but I've been stuck trying to get even the basic Readme example working. I found this comment in issue #46 which referred to the issue changing when "hitting enter." As it turns out, the CLI documentation will only render for me if there are at least two spaces at the end of the markdown file, otherwise it renders the header but not CLI documentation.

e.g. this will only render the heading CLI Reference

# CLI Reference

::: mkdocs-click
    :module: app.cli
    :command: cli

but this will render the heading and generated documentation.

# CLI Reference

::: mkdocs-click
    :module: app.cli
    :command: cli
<newline>
<newline>

It's a particular challenge for new users where they are likely to copy / paste the readme example into a new text file in order to begin testing and immediately hit a deadend. In my case, I assumed there was something arcane about the :module: reference (does it follow standard library import hierarchies, are they directory hierarchies, something else, etc...)

ofek commented 2 years ago

I think part of the issue is that h1 is set as the CLI's name. Can you try :depth: 1 or removing header?

ieaves commented 2 years ago

Hey @ofek. Sure! Here are a few of the variations I've attempted based on your suggestion

None of those work, however, they all work if there are two spaces at the end of the file.

EDIT: I can also add, the issue was identical for me in two different environments, one arch linux and the other macOS.

Double edit: It also works with a newline + space or newline + tab.

sveint commented 2 years ago

I can confirm the issue.

I thought something was misconfigured, but then I found this issue and thought I'd try it out. For me a single newline with no extra characters fixes the problem.

Gustavo-SF commented 2 years ago

I also had this same issue on macOS 12.4, Python3.10 and mkdocs-click version 0.8.0. Fixed it with a double newline at the end.

matroscoe commented 1 year ago

I also ran into this issue, if it is required (it is really okay that it is) ideally there would be a check for this at build time (or a note in the README). I spent a fair amount of time banging my head against a wall to find out why I couldn't get my docs to generate.

Python 3.11, Ubuntu 22.04, mkdocs-click = "^0.8.0"