pdoc
pdoc copied to clipboard
Strip docstring from source code examples
It would be very nice to be able to just look at the source code w/o all the comments.
If you expand play you can see that the documentation text is quite long and does not need to be there.

It'd also be cool to remove any other config/text that is predictable.
I understood you'd like to collapse the repeated docstring in the item's source code view.
Pdoc only outputs raw <pre><code>, leaving further markup to Highlight.js:
https://github.com/pdoc3/pdoc/blob/004204320773cb98a8f0cd5fa82e8095f517e488/pdoc/templates/html.mako#L427-L430
You can remove the strings if you issue:
Array.from(document.querySelectorAll(
'.source code.python .hljs-class + .hljs-string, \
.source code.python .hljs-function + .hljs-string'
)).forEach(el => el.parentNode.removeChild(el))
I guess something similar could be issued to wrap in <details>. I'd be interested in a small working snippet if you find it. :+1:
I was thinking something in the python code. There is no reason to have the docstring in the code source link.
oh i misunderstood. I'll have to dig in and submit a PR i guess.