Zulip Chat Archive

Stream: general

Topic: editor for writing docstrings


Kevin Buzzard (Dec 23 2020 at 14:20):

So usually when I write a half-decent attempt at a module docstring, I have a go with the 's and the $$s and mixing unicode and TeX, but I occasionally get it wrong, and then when I make the PR Bryan comes along within an hour and tidies up all the typesetting errors I've made. How is Bryan doing this? Is there a way for me to take a local lean file and view the corresponding module docstring in a browser as it would be displayed in the API documentation (a module docstring documents an entire .lean file , right?) I would be a better module docstring writer if I knew how to do this.

In fact I probably think it's worth saying at this point how brilliant @Bryan Gin-ge Chen is. I've never even met him, but every PR I make he goes straight in there and fixes up little slips I've made like an incorrectly formatted commit name or a docstring markup mess -- he's training me to be a better PR maker and hence less trouble to the maintainers (he also taught me about correct use of tags).

Eric Wieser (Dec 23 2020 at 14:32):

The unpleasant answer is "just run doc-gen locally", but that takes forever to generate the export data and I don't actually recommend it.

Sebastien Gouezel (Dec 23 2020 at 14:38):

The pleasant answer is: use https://observablehq.com/@bryangingechen/github-lean-doc-preview (give a PR number, and it will show you the rendered docstrings)

Johan Commelin (Dec 23 2020 at 14:46):

we should have a zulip linkifier for this

Johan Commelin (Dec 23 2020 at 14:46):

something like docpreview#1234

Rob Lewis (Dec 23 2020 at 15:37):

I don't know if the preview accepts the PR number as part of the url, and in any case, Zulip's linkifier complains about the @ in the url. So for now, #docpreview one sec

Rob Lewis (Dec 23 2020 at 15:38):

#docpreview

Johan Commelin (Dec 23 2020 at 15:39):

thanks Rob!

Bryan Gin-ge Chen (Dec 23 2020 at 21:54):

Thanks Kevin! I'm glad the previewer is still useful. I haven't been advertising it much lately, but I do find it helpful previewing the output of docstrings and module docs. Note that there can be differences with what actually shows up in the final rendered docs, either due to weird parsing hacks I resorted to or due to markdown2 limitations on the doc-gen side.


Last updated: Dec 20 2023 at 11:08 UTC