Skip to content

basic documentation using quartodoc #12

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,5 @@ dmypy.json

# Cython debug symbols
cython_debug/

/.quarto/
39 changes: 2 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,4 @@
# quarto-python

Python interface to the Quarto CLI (https://quarto-dev/quarto-cli).



## theme helpers

`quarto-python` contains theme helpers to do basic background/foreground theming of plots and tables

The `theme_colors_*` functions take background and foreground colors:

| parameter | description |
| --------- | ----------- |
| `bg` | background color |
| `fg` | foreground color |

The `theme_brand_*` functions take a [brand.yml](https://posit-dev.github.io/brand-yml/) file:

| parameter | description |
| --------- | ----------- |
| `brand_yml` | path to **brand.yml** file |

Available theme helpers:

| colors | brand |
| --------- | ----------- |
| `theme_colors_altair` | `theme_brand_altair` |
| `theme_colors_bokeh` | `theme_brand_bokeh` |
| `theme_colors_great_tables` | `theme_brand_great_tables` |
| `theme_colors_matplotlib` | `theme_brand_matplotlib` |
| `theme_colors_plotnine` | `theme_brand_plotnine` |
| `theme_colors_plotly` | `theme_brand_plotly` |
| `theme_colors_pygal` | `theme_brand_pygal` |
| `theme_colors_seaborn` | `theme_brand_seaborn` |

The usage of the returned object or function depends on the package. See this repo for usage examples:

https://github.com/quarto-dev/quarto-examples/tree/main/renderings
Python interface to the Quarto CLI (https://quarto-dev/quarto-cli),
and helper functions for use inside Quarto documents.
61 changes: 61 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
project:
type: website

# tell quarto to read the generated sidebar
metadata-files:
- reference/_sidebar.yml

# tell quarto to read the generated styles
format:
html:
css:
- reference/_styles-quartodoc.css

quartodoc:
# the name used to import the package you want to create reference docs for
package: quarto

# write sidebar and style data
sidebar: reference/_sidebar.yml
css: reference/_styles-quartodoc.css

sections:
- title: Quarto functions
# desc: Helper functions to apply background/foreground theming of plots and tables.
contents:
- dynamic: true
name: path
# desc: Returns the path to the Quarto executable.
- dynamic: true
name: render
# desc: Renders a Quarto document.
- dynamic: true
name: metadata
- kind: page
summary:
name: theme helpers
desc: |
`theme_colors_*` functions take background and foreground colors.

`theme_brand_*` functions take a [brand.yml](https://posit-dev.github.io/brand-yml/) file.

The usage of the returned object or function depends on the package. See the [`quarto-examples` repo
for usage examples](https://github.com/quarto-dev/quarto-examples/tree/main/renderings).
path: theme_helpers
contents:
- theme_colors_altair
- theme_brand_altair
- theme_colors_bokeh
- theme_brand_bokeh
- theme_colors_great_tables
- theme_brand_great_tables
- theme_colors_matplotlib
- theme_brand_matplotlib
- theme_colors_plotnine
- theme_brand_plotnine
- theme_colors_plotly
- theme_brand_plotly
- theme_colors_pygal
- theme_brand_pygal
- theme_colors_seaborn
- theme_brand_seaborn
1 change: 1 addition & 0 deletions quarto/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from quarto.quarto import find_quarto

def metadata(input):
"""Return the metadata for a Quarto document."""
args = ["metadata", input, "--json"]
metadata_json = subprocess.check_output([find_quarto()] + args)
return json.loads(metadata_json)
Expand Down
1 change: 1 addition & 0 deletions quarto/quarto.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess

def path():
"""Return the path to the Quarto executable."""
path_env = os.getenv("QUARTO_PATH")
if path_env is None:
return shutil.which("quarto")
Expand Down
2 changes: 1 addition & 1 deletion quarto/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def render(input,
debug = False,
quiet = False,
pandoc_args = None):

"""Render a Quarto document."""
# params file to remove after render
params_file = None

Expand Down