add @doc_section("Wibble")
#3436
Replies: 3 comments 8 replies
-
... old habits die hard ref fubar. |
Beta Was this translation helpful? Give feedback.
-
Maybe I'd start use the discussion forums to first talk about the design of such a feature. |
Beta Was this translation helpful? Give feedback.
-
I like this idea a lot but the details are not entirely clear to me. I worry that having attributes as dividers would make them easy to make mistakes with. It's not immediately obvious what the previous and next sections are. Perhaps I am incorrect there. I've seen in Elm projects it's common to have comments like One thing I like about the divider approach is that it makes it harder to have dangling uncategorised definitions than if each had to be individually annotated with an attribute. If the attribute syntax is used it should be on some declaration rather than being a divider. I could imagine it being desirable to have a way to add a header of markdown content to each section. Using moduledocsPerhaps the module doc syntax could be reused for this. At the top of the file it would be for the whole module, and then each one under that introduces a new section. A markdown heading could be used to name the section, though what we would do without a heading I am unsure. //// The Wisp web framework
import gleam/list
... etc
//// # Requests
////
//// lorem ipsum...
pub fn require_method(
request: HttpRequest(t),
method: Method,
next: fn() -> Response,
) -> Response {
case request.method == method {
True -> next()
False -> method_not_allowed(allowed: [method])
}
}
...
//// # Responses
////
//// lorem ipsum...
/// The body of a HTTP response, to be sent to the client.
///
pub type Body {
Text(StringBuilder)
Bytes(BytesBuilder)
File(path: String)
Empty
}
pub fn response(status: Int) -> Response {
HttpResponse(status, [], Empty)
}
...
//// # Configuration
////
//// lorem ipsum...
pub fn set_max_body_size(request: Request, size: Int) -> Request {
Connection(..request.body, max_body_size: size)
|> request.set_body(request, _)
}
... |
Beta Was this translation helpful? Give feedback.
-
... to group docs into sections
Beta Was this translation helpful? Give feedback.
All reactions