Skip to content

Commit

Permalink
Merge pull request #159 from sirosen/fix-source-link-alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Jun 18, 2021
2 parents 766954a + 56dde13 commit 2f3b0df
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# Full list of options can be found in the Sphinx documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys

# add the demo python code to the path, so that it can be used to demonstrate
# source links
sys.path.append(os.path.abspath("./kitchen-sink/demo_py"))

#
# -- Project information -----------------------------------------------------
#
Expand Down
9 changes: 9 additions & 0 deletions docs/kitchen-sink/autodoc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*******
Autodoc
*******

This is a run of automodule to grab classes, functions, and members from the
demo module.

.. automodule:: furo_demo_module
:members:
28 changes: 28 additions & 0 deletions docs/kitchen-sink/demo_py/furo_demo_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
This is a demo module included in the docs in order to exercise viewcode,
autodoc, and other related functionality.
"""


class Foo:
"""
A demo class of type Foo.
Has a method baz() returning ints.
"""

def baz(self) -> int:
"""
Return a random integer.
See also: https://xkcd.com/221/
"""
return 3


def bar(f: Foo) -> Foo:
"""
the identity function, but only for Foos
"""
if isinstance(f, Foo):
return f
raise TypeError("Expected a Foo!")
1 change: 1 addition & 0 deletions docs/kitchen-sink/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ demo
lists_tables
really-long
structure
autodoc
```
11 changes: 4 additions & 7 deletions src/furo/assets/styles/content/_api.sass
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ dl.exception
color: var(--color-api-keyword)
padding-right: 0.25rem

// Align the [source] to the right.
code.sig-name.descname, // final part of named object.
span.sig-paren, // final ')' on a method definition
> span.pre // return annotation, on a function definition
+ a.reference.internal
// adjust the size of the [source] link on the right.
a.reference.internal
.viewcode-link
width: 3.5rem
float: right
font-size: var(--font-size--small)

.sig-name
Expand All @@ -81,7 +78,7 @@ div.versionadded, div.versionchanged, div.deprecated
margin-top: 0.125rem
margin-bottom: 0.125rem

// Align the [docs] to the right.
// Align the [docs] and [source] to the right.
.viewcode-link, .viewcode-back
float: right
text-align: right

0 comments on commit 2f3b0df

Please sign in to comment.