Compare commits

..

4 commits

Author SHA1 Message Date
Izalia Mae 8a5a13f516 put a new line between the short and long description 2024-10-14 15:51:06 -04:00
Izalia Mae 594af5658b remove unnecessary method 2024-10-14 15:47:56 -04:00
Izalia Mae 7673920141 treat doc strings as markdown 2024-10-14 15:46:51 -04:00
Izalia Mae 2093af8217 minor styling fix for parameters on docs page 2024-10-14 15:46:15 -04:00
5 changed files with 12 additions and 10 deletions

View file

@ -7,7 +7,7 @@
%a.endpoint(id="{{method.name.replace('handle_', '')}}" href="#{{method.name.replace('handle_', '')}}") %a.endpoint(id="{{method.name.replace('handle_', '')}}" href="#{{method.name.replace('handle_', '')}}")
{{method.method.upper()}} {{method.path}} {{method.method.upper()}} {{method.path}}
%span.description -> =method.docs .description -> -markdown -> =method.docs
-if method.parameters -if method.parameters
.parameters .parameters
@ -19,5 +19,5 @@
-if not param.has_default -if not param.has_default
%span.required << *required %span.required << *required
.doc -> =param.docs .doc -> -markdown -> =param.docs

View file

@ -405,6 +405,10 @@ textarea {
padding: 5px; padding: 5px;
} }
#content.page-api_documentation .parameter .doc {
margin: 5px 0px;
}
#content.page-api_documentation .parameter:not(:first-child) { #content.page-api_documentation .parameter:not(:first-child) {
margin-top: 5px; margin-top: 5px;
margin-bottom: 0px; margin-bottom: 0px;

View file

@ -20,7 +20,7 @@ if TYPE_CHECKING:
class Template(Environment): class Template(Environment):
_render_markdown: Callable[[str], str] render_markdown: Callable[[str], str]
def __init__(self, app: Application): def __init__(self, app: Application):
@ -58,10 +58,6 @@ class Template(Environment):
return self.get_template(path).render(new_context) return self.get_template(path).render(new_context)
def render_markdown(self, text: str) -> str:
return self._render_markdown(text)
class MarkdownExtension(Extension): class MarkdownExtension(Extension):
tags = {'markdown'} tags = {'markdown'}
extensions = ( extensions = (
@ -75,7 +71,7 @@ class MarkdownExtension(Extension):
Extension.__init__(self, environment) Extension.__init__(self, environment)
self._markdown = Markdown(extensions = MarkdownExtension.extensions) self._markdown = Markdown(extensions = MarkdownExtension.extensions)
environment.extend( environment.extend(
_render_markdown = self._render_markdown render_markdown = self._render_markdown
) )

View file

@ -24,7 +24,9 @@ async def handle_authorize_get(
client_id: str, client_id: str,
redirect_uri: str) -> Response: redirect_uri: str) -> Response:
""" """
Authorize an application. Redirects to the application's redirect URI if accepted. Authorize an application.
Redirects to the application's redirect URI if accepted.
:param response_type: What to respond with. Should always be set to ``code``. :param response_type: What to respond with. Should always be set to ``code``.
:param client_id: Application identifier :param client_id: Application identifier

View file

@ -53,7 +53,7 @@ def parse_docstring(docstring: str) -> tuple[str, dict[str, str]]:
body = cast(str, ds.short_description) body = cast(str, ds.short_description)
else: else:
body = "\n".join([ds.short_description, ds.long_description]) # type: ignore[list-item] body = "\n\n".join([ds.short_description, ds.long_description]) # type: ignore[list-item]
return body, params return body, params