-
I am generating documentation from docstrings. I've tried both Google style docstrings and Numpy style. I noticed that the Google Style docstrings looks significantly better and has all the nice widgets where as the numpy documentation looks bad. Is there any way that I can mess with the configuration to make it look a lot better? Do I have my configurations wrong? I am using material MKDocs MKDocs.yaml Configurationsplugins:
- search
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [src, docs]
options:
show_bases: true
show_source: true
docstring_style: numpy
watch:
- src/
markdown_extensions:
- toc:
baselevel: 2
permalink: True
- attr_list
- md_in_html
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.critic
- pymdownx.caret
- pymdownx.keys
- pymdownx.mark
- pymdownx.tilde
- pymdownx.tabbed:
alternate_style: true
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Hello!
Unfortunately this is very subjective and I cannot know what you see and what you expect instead. Please share some code and screenshots that replicate the issue so that I can provide some help. |
Beta Was this translation helpful? Give feedback.
-
that makes sense. Google ConfigurationScreenshotMKDocs.yaml configurationplugins:
- search
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [src, docs]
options:
show_bases: true
show_source: true
docstring_style: google
watch:
- src/ Google Docstrings @property
def source(self) -> str:
"""
The File node source can be set to be either a path to a local file on disk
or a URL path to a file on the web.
Example:
URL File Source
```python
url_source = "https://wikipedia.com"
my_file.source = url_source
```
Local File Path
```python
my_file.source = "/home/user/project/my_file.csv"
```
Returns:
source: str
A string representing the file source.
""" Numpy ConfigurationScreenshotMKDocs.yamlplugins:
- search
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [src, docs]
options:
show_bases: true
show_source: true
docstring_style: numpy
watch:
- src/ Numpy Docstrings @property
def source(self) -> str:
"""
The File node source can be set to be either a path to a local file on disk
or a URL path to a file on the web.
Example
--------
URL File Source
```python
url_source = "https://wikipedia.com"
my_file.source = url_source
```
Local File Path
```python
my_file.source = "/home/user/project/my_file.csv"
```
Returns
-------
source: str
A string representing the file source.
""" |
Beta Was this translation helpful? Give feedback.
-
thank you so much that helps a lot. I tried putting it as Screenshot @property
def source(self) -> str:
"""
The File node source can be set to be either a path to a local file on disk
or a URL path to a file on the web.
Examples
--------
URL File Source
```python
url_source = "https://wikipedia.com"
my_file.source = url_source
```
Local File Path
```python
my_file.source = "/home/user/project/my_file.csv"
```
Returns
-------
source: str
A string representing the file source.
""" am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
-
got it! Thank you! |
Beta Was this translation helpful? Give feedback.
Thanks a lot, that's what I needed to see.
So, the only difference I see is that Google docstrings support arbitrary admonitions (in this case: Example), while Numpy docstrings do not. If you look at the table of supported sections per style, you'll see that both style expect "Examples" (plural). With the Google-style, "Example" (singular) falls back to being parsed as an admonition. With the Numpy style, which does not support arbitrary admonitions, it falls back as being parsed as a text block, which is then rendered as Markdown, and therefore as a heading (hence the small, grey "Example" heading in your screenshot).
We're open to adding support for arbitrary admonitions with the Numpy …