mkdocs-click icon indicating copy to clipboard operation
mkdocs-click copied to clipboard

Indented ::: mkdocs-click blocks are not picked up

Open pawamoy opened this issue 2 years ago • 0 comments

Users of mkdocstrings noticed that indented mkdocs-click blocks are not picked up and handled by mkdocs-click, and later (block processors) mkdocstrings picks it up (we use the same syntax :::) and errors out since it do not support the rest of the syntax.

Would it be possible to loosen a bit the regex to match blocks starting with spaces?

The alternative is to implement the processor as a block processor rather than a pre-processor, and indentation will be handled for you automatically. You'd just have to make sure to keep using a higher priority than mkdocstrings, since you match the contents after ::: more specifically (strictly equal to mkdocs-click in your case, while mkdocstrings matches anything).

For reference, our block processor implementation:

  • test method: https://github.com/mkdocstrings/mkdocstrings/blob/228fb737caca4e20e600053bf59cbfa3e9c73906/src/mkdocstrings/extension.py#L97
  • run method: https://github.com/mkdocstrings/mkdocstrings/blob/228fb737caca4e20e600053bf59cbfa3e9c73906/src/mkdocstrings/extension.py#L109-L118

pawamoy avatar Sep 06 '23 08:09 pawamoy