-
Notifications
You must be signed in to change notification settings - Fork 23
docs: example code block notes #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@wch does this note below the code example look okay? ![]() |
I think it's still a bit unclear what happens when the quarto code block executed. Does it include the output as well, and how is it all formatted? For example, I could imagine that it looks like this when executed:
Or maybe it just executes it and prints the output, like this:
Or maybe the code and output are in two separate blocks:
Currently, the reader would have to actually test it out in order to find out what the output would look like -- it would be much better to show what it would do. |
One more quick thought: I know that Quarto does allow customization to the output. So maybe show what the default behavior is, and then point the reader to the Quarto docs for controlling the output behavior if they want to customize it. |
I've tinkered a bit more, and think I remember the big challenge was with showing results for these examples. Basically, quarto is absolutely nuts when it comes to...
For example this is how I got quarto to not error for the example: from griffe.docstrings import Parser
from griffe.dataclasses import Docstring
from quartodoc.renderers import MdRenderer
# Note the nuts string combining
# to create the phrase "```python```"
# or the phrase "{python}
doc = """
Examples
--------
doctest syntax:
>>> 1 + 1
2
markdown syntax:
""" "```" "python" """
1 + 1
```
quarto syntax:
```""" "{" "python" "}" """
1 + 1
```
"""
ds = Docstring(doc, parser = Parser("numpy"))
rendered = MdRenderer().render(ds)
print(rendered) Here's what gets printed out on the page:
Note that the result of Seems related to quarto-dev/quarto-cli#3179 |
I mean that the weirdness literally appears on the page edit: here's the relevant part from setting
|
Addresses