Skip to content

Commit

Permalink
feat: Use absolute URLs in API docs #2078 (#2088)
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok authored and mturoci committed Aug 3, 2023
1 parent abd6e7d commit f2bc239
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion py/docs/templates/config.mako
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# A prefix to use for every HTML hyperlink in the generated documentation.
# No prefix results in all links being relative.
link_prefix = ''
link_prefix = 'docs/api/'
# Enable syntax highlighting for code/source blocks by including Highlight.js
syntax_highlighting = False
Expand Down
6 changes: 3 additions & 3 deletions py/docs/templates/text.mako
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
name = name or dobj.qualname + ('()' if isinstance(dobj, pdoc.Function) else '')
if isinstance(dobj, pdoc.External) and not external_links:
return name
url = dobj.url(relative_to=module, link_prefix=link_prefix,
top_ancestor=not show_inherited_members).replace('.html','')
url = dobj.url(link_prefix=link_prefix, top_ancestor=not show_inherited_members).replace('.html','')
## Replace "." with "_" because Docusarus doesn't seem to like "." in custom heading ids.
return '<a title="{}" href="{}">{}</a>'.format(dobj.refname, url.replace('.', '_'), name)
return f'<a title="{dobj.refname}" href={{useBaseUrl("{url.replace("h2o_wave/", "").replace(".", "_")}")}}>{name}</a>'
def to_html(text):
Expand Down Expand Up @@ -84,6 +83,7 @@ title: ${'Namespace' if module.is_namespace else \
'Package' if module.is_package and not module.supermodule else \
'Module'} ${module.name}
---
import useBaseUrl from '@docusaurus/useBaseUrl';
${module.docstring | to_html}
Expand Down

0 comments on commit f2bc239

Please sign in to comment.