Giter VIP home page Giter VIP logo

Comments (5)

MichaelHatherly avatar MichaelHatherly commented on July 3, 2024 1

We could also probably provide a couple of default templates that package authors can just use out-of-the-box.

from docstringextensions.jl.

MichaelHatherly avatar MichaelHatherly commented on July 3, 2024

Any idea how you'd like these templates to look? How would they be applied to individual "untemplated" docstrings, i.e. how would you mark which part of each docstring gets inserted into each template "slot"?

from docstringextensions.jl.

sivark avatar sivark commented on July 3, 2024

Right now, one gets to specify a template for the docstring of each function (and some details get filled into the template). I was instead thinking of a global template that would apply to all functions in a module, so that

  1. The same template need not be repeated for each function, making it more convenient for the programmer.
  2. It could automatically introduce some uniformity in documentation.

This is a rough sketch of the structure I had in mind:

@GlobalTemplate FunctionDocstring
"""
$(SIGNATURES(:with_types))

$(DESCRIPTION)

$(URL)
"""

where $(DESCRIPTION) is any content that is located where the docstring for a function is conventionally located.

I hadn't imagined the possibility of some functions/docstrings overriding this template. Maybe one can arrange for that with a suitable flag.

from docstringextensions.jl.

MichaelHatherly avatar MichaelHatherly commented on July 3, 2024

Thanks for clarifying that, DESCRIPTION was the part I was looking for I think. So all the content from each docstring would just be spliced into it's place, which sounds reasonable to me, would there be cases where one would want to intersperse parts of the description with the different abbreviations perhaps?

URL is probably not something that should really be included since it's already output by Documenter.jl itself. We could possibly just filter out potentially duplicate info during doc rendering though.

Would you want to be able to define different templates for different categories such as method, type, macro, const, etc? I'd imagine that would probably be useful.

from docstringextensions.jl.

sivark avatar sivark commented on July 3, 2024

would there be cases where one would want to intersperse parts of the description with the different abbreviations perhaps?

I'm not able to think of a compelling need right now; might just be a lack
of imagination.

URL is probably not something that should really be included since it's already output by Documenter.jl itself. We could possibly just filter out potentially duplicate info during doc rendering though.

Fair enough. That was only an illustration; the user could remix whatever
abbreviations the library exports, into the global template.

Would you want to be able to define different templates for different categories such as method, type, macro, const, etc? I'd imagine that would probably be useful.

Yes, that's what I had in mind. Maybe all those templates could be
collected in a separate file as convenient.

from docstringextensions.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.