Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
daizutabi committed Feb 11, 2024
1 parent 833eafd commit 26228a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
29 changes: 18 additions & 11 deletions docs/usage/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ This part is a *heading* of the object documentation.
After the heading, main contents of documentation
are rendered.
Contents of the `examples` package is just
one-line summary for the package.
one-line summary for the package:

MkAPI can embed the source code of objects as well as their
```python title="examples/__init__.py"
--8<-- "tests/examples/__init__.py"
```

<!-- MkAPI can embed the source code of objects as well as their
documentation. For this, use *filters* like below:
```markdown
Expand All @@ -93,6 +97,7 @@ The output is shown below:
::: examples|source|bare
The above docstring is entire contents of `examples/__init__.py`.
-->

## Package with `__all__`

Expand Down Expand Up @@ -123,7 +128,9 @@ These names has a link to the object documentation to navigate you.
The summary line for classes is also shown for convinience.
Below is the source code of `examples/styles/__init__.py`.

::: examples.styles|source|bare
```python title="examples/styles/__init__.py"
--8<-- "tests/examples/styles/__init__.py"
```

Two modules (`google` and `numpy`) have their own class
with the same name of `ExampleClass`.
Expand Down Expand Up @@ -193,26 +200,23 @@ You can check the corresponding docstring

The last part of this page is for module members.
The syntax to embed these objects is the same as package or module.
In addition, a new filter `sourcelink` is introduced here.
<!-- In addition, a new filter `sourcelink` is introduced here. -->

### Class

`examples.styles.goole` module has an `ExampleClass` class.
You can write like below:

```markdown
::: examples.styles.google.ExampleClass|sourcelink
::: examples.styles.google.ExampleClass
```

A new `sourcelink` filter is added at the end of line.
<!-- A new `sourcelink` filter is added at the end of line.
This filter creates a link to the source code
to enable to visit it easily.
Let's see the output.
A `[source]` tag is added in the right side of the heading .
You can click it to see the source code.

Functions or attributes can also be embeded in a Markdown source
in the same way as described above.
You can click it to see the source code. -->

There is another useful feature.
The heading of object documentation contains the fullname of an object.
Expand All @@ -235,12 +239,15 @@ Here,
You can check these links by hovering mouse cursor
on the name segments.

::: examples.styles.google.ExampleClass|sourcelink
::: examples.styles.google.ExampleClass

!!! note
Currently, `__special__` and `_private` members
are treated as a normal member.

Functions or attributes can also be embeded in a Markdown source
in the same way as described above.

### Function

```markdown
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ markdown_extensions:
- pymdownx.highlight:
use_pygments: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
Expand Down

0 comments on commit 26228a1

Please sign in to comment.